stub-cache.h revision a7e24c173cf37484693b9abb38e494fa7bd7baeb
1a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Copyright 2006-2008 the V8 project authors. All rights reserved. 2a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Redistribution and use in source and binary forms, with or without 3a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// modification, are permitted provided that the following conditions are 4a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// met: 5a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// 6a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// * Redistributions of source code must retain the above copyright 7a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// notice, this list of conditions and the following disclaimer. 8a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// * Redistributions in binary form must reproduce the above 9a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// copyright notice, this list of conditions and the following 10a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// disclaimer in the documentation and/or other materials provided 11a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// with the distribution. 12a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// * Neither the name of Google Inc. nor the names of its 13a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// contributors may be used to endorse or promote products derived 14a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// from this software without specific prior written permission. 15a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// 16a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 28a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#ifndef V8_STUB_CACHE_H_ 29a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#define V8_STUB_CACHE_H_ 30a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 31a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#include "macro-assembler.h" 32a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 33a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blocknamespace v8 { 34a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blocknamespace internal { 35a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 36a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 37a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// The stub cache is used for megamorphic calls and property accesses. 38a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// It maps (map, name, type)->Code* 39a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 40a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// The design of the table uses the inline cache stubs used for 41a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// mono-morphic calls. The beauty of this, we do not have to 42a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// invalidate the cache whenever a prototype map is changed. The stub 43a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// validates the map chain as in the mono-morphic case. 44a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 45a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass SCTableReference; 46a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 47a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass StubCache : public AllStatic { 48a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 49a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block struct Entry { 50a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* key; 51a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Code* value; 52a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block }; 53a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 54a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 55a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void Initialize(bool create_heap_objects); 56a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 57a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Computes the right stub matching. Inserts the result in the 58a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // cache before returning. This might compile a stub if needed. 59a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeLoadField(String* name, 60a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 61a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 62a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int field_index); 63a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 64a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeLoadCallback(String* name, 65a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 66a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 67a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block AccessorInfo* callback); 68a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 69a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeLoadConstant(String* name, 70a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 71a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 72a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* value); 73a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 74a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeLoadInterceptor(String* name, 75a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 76a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder); 77a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 78a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeLoadNormal(String* name, JSObject* receiver); 79a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 80a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 81a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeLoadGlobal(String* name, 82a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 83a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block GlobalObject* holder, 84a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSGlobalPropertyCell* cell, 85a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block bool is_dont_delete); 86a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 87a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 88a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // --- 89a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 90a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeKeyedLoadField(String* name, 91a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 92a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 93a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int field_index); 94a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 95a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeKeyedLoadCallback(String* name, 96a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 97a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 98a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block AccessorInfo* callback); 99a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 100a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeKeyedLoadConstant(String* name, JSObject* receiver, 101a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, Object* value); 102a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 103a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeKeyedLoadInterceptor(String* name, 104a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 105a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder); 106a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 107a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeKeyedLoadArrayLength(String* name, JSArray* receiver); 108a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 109a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeKeyedLoadStringLength(String* name, 110a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* receiver); 111a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 112a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeKeyedLoadFunctionPrototype(String* name, 113a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSFunction* receiver); 114a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 115a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // --- 116a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 117a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeStoreField(String* name, 118a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 119a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int field_index, 120a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Map* transition = NULL); 121a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 122a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeStoreGlobal(String* name, 123a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block GlobalObject* receiver, 124a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSGlobalPropertyCell* cell); 125a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 126a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeStoreCallback(String* name, 127a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 128a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block AccessorInfo* callback); 129a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 130a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeStoreInterceptor(String* name, JSObject* receiver); 131a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 132a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // --- 133a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 134a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeKeyedStoreField(String* name, 135a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 136a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int field_index, 137a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Map* transition = NULL); 138a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 139a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // --- 140a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 141a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallField(int argc, 142a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block InLoopFlag in_loop, 143a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 144a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* object, 145a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 146a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index); 147a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 148a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallConstant(int argc, 149a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block InLoopFlag in_loop, 150a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 151a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* object, 152a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 153a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSFunction* function); 154a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 155a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallNormal(int argc, 156a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block InLoopFlag in_loop, 157a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 158a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver); 159a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 160a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallInterceptor(int argc, 161a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 162a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* object, 163a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder); 164a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 165a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallGlobal(int argc, 166a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block InLoopFlag in_loop, 167a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 168a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* receiver, 169a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block GlobalObject* holder, 170a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSGlobalPropertyCell* cell, 171a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSFunction* function); 172a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 173a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // --- 174a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 175a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallInitialize(int argc, InLoopFlag in_loop); 176a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallPreMonomorphic(int argc, InLoopFlag in_loop); 177a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallNormal(int argc, InLoopFlag in_loop); 178a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallMegamorphic(int argc, InLoopFlag in_loop); 179a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallMiss(int argc); 180a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 181a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Finds the Code object stored in the Heap::non_monomorphic_cache(). 182a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Code* FindCallInitialize(int argc, InLoopFlag in_loop); 183a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 184a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#ifdef ENABLE_DEBUGGER_SUPPORT 185a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallDebugBreak(int argc); 186a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeCallDebugPrepareStepIn(int argc); 187a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#endif 188a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 189a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Object* ComputeLazyCompile(int argc); 190a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 191a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 192a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Update cache for entry hash(name, map). 193a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Code* Set(String* name, Map* map, Code* code); 194a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 195a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Clear the lookup table (@ mark compact collection). 196a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void Clear(); 197a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 198a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Functions for generating stubs at startup. 199a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateMiss(MacroAssembler* masm); 200a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 201a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Generate code for probing the stub cache table. 202a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // If extra != no_reg it might be used as am extra scratch register. 203a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateProbe(MacroAssembler* masm, 204a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Code::Flags flags, 205a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 206a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register name, 207a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch, 208a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register extra); 209a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 210a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block enum Table { 211a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block kPrimary, 212a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block kSecondary 213a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block }; 214a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 215a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 216a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block friend class SCTableReference; 217a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kPrimaryTableSize = 2048; 218a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static const int kSecondaryTableSize = 512; 219a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Entry primary_[]; 220a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Entry secondary_[]; 221a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 222a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Computes the hashed offsets for primary and secondary caches. 223a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static int PrimaryOffset(String* name, Code::Flags flags, Map* map) { 224a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // This works well because the heap object tag size and the hash 225a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // shift are equal. Shifting down the length field to get the 226a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // hash code would effectively throw away two bits of the hash 227a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // code. 228a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block ASSERT(kHeapObjectTagSize == String::kHashShift); 229a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Compute the hash of the name (use entire length field). 230a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block ASSERT(name->HasHashCode()); 231a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uint32_t field = name->length_field(); 232a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Using only the low bits in 64-bit mode is unlikely to increase the 233a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // risk of collision even if the heap is spread over an area larger than 234a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // 4Gb (and not at all if it isn't). 235a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uint32_t map_low32bits = 236a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static_cast<uint32_t>(reinterpret_cast<uintptr_t>(map)); 237a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // We always set the in_loop bit to zero when generating the lookup code 238a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // so do it here too so the hash codes match. 239a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uint32_t iflags = 240a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup); 241a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Base the offset on a simple combination of name, flags, and map. 242a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uint32_t key = (map_low32bits + field) ^ iflags; 243a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block return key & ((kPrimaryTableSize - 1) << kHeapObjectTagSize); 244a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block } 245a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 246a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static int SecondaryOffset(String* name, Code::Flags flags, int seed) { 247a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Use the seed from the primary cache in the secondary cache. 248a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uint32_t string_low32bits = 249a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)); 250a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // We always set the in_loop bit to zero when generating the lookup code 251a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // so do it here too so the hash codes match. 252a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uint32_t iflags = 253a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block (static_cast<uint32_t>(flags) & ~Code::kFlagsICInLoopMask); 254a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block uint32_t key = seed - string_low32bits + iflags; 255a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block return key & ((kSecondaryTableSize - 1) << kHeapObjectTagSize); 256a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block } 257a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 258a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Compute the entry for a given offset in exactly the same way as 259a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // we do in generated code. We generate an hash code that already 260a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // ends in String::kHashShift 0s. Then we shift it so it is a multiple 261a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // of sizeof(Entry). This makes it easier to avoid making mistakes 262a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // in the hashed offset computations. 263a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static Entry* entry(Entry* table, int offset) { 264a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block const int shift_amount = kPointerSizeLog2 + 1 - String::kHashShift; 265a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block return reinterpret_cast<Entry*>( 266a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block reinterpret_cast<Address>(table) + (offset << shift_amount)); 267a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block } 268a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 269a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 270a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 271a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass SCTableReference { 272a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 273a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static SCTableReference keyReference(StubCache::Table table) { 274a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block return SCTableReference( 275a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block reinterpret_cast<Address>(&first_entry(table)->key)); 276a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block } 277a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 278a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 279a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static SCTableReference valueReference(StubCache::Table table) { 280a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block return SCTableReference( 281a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block reinterpret_cast<Address>(&first_entry(table)->value)); 282a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block } 283a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 284a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Address address() const { return address_; } 285a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 286a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 287a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block explicit SCTableReference(Address address) : address_(address) {} 288a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 289a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static StubCache::Entry* first_entry(StubCache::Table table) { 290a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block switch (table) { 291a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block case StubCache::kPrimary: return StubCache::primary_; 292a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block case StubCache::kSecondary: return StubCache::secondary_; 293a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block } 294a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block UNREACHABLE(); 295a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block return NULL; 296a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block } 297a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 298a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Address address_; 299a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 300a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 301a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// ------------------------------------------------------------------------ 302a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 303a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 304a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Support functions for IC stubs for callbacks. 305a7e24c173cf37484693b9abb38e494fa7bd7baebSteve BlockObject* LoadCallbackProperty(Arguments args); 306a7e24c173cf37484693b9abb38e494fa7bd7baebSteve BlockObject* StoreCallbackProperty(Arguments args); 307a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 308a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 309a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Support functions for IC stubs for interceptors. 310a7e24c173cf37484693b9abb38e494fa7bd7baebSteve BlockObject* LoadPropertyWithInterceptorOnly(Arguments args); 311a7e24c173cf37484693b9abb38e494fa7bd7baebSteve BlockObject* LoadPropertyWithInterceptorForLoad(Arguments args); 312a7e24c173cf37484693b9abb38e494fa7bd7baebSteve BlockObject* LoadPropertyWithInterceptorForCall(Arguments args); 313a7e24c173cf37484693b9abb38e494fa7bd7baebSteve BlockObject* StoreInterceptorProperty(Arguments args); 314a7e24c173cf37484693b9abb38e494fa7bd7baebSteve BlockObject* CallInterceptorProperty(Arguments args); 315a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 316a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 317a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// Support function for computing call IC miss stubs. 318a7e24c173cf37484693b9abb38e494fa7bd7baebSteve BlockHandle<Code> ComputeCallMiss(int argc); 319a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 320a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 321a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block// The stub compiler compiles stubs for the stub cache. 322a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass StubCompiler BASE_EMBEDDED { 323a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 324a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block enum CheckType { 325a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block RECEIVER_MAP_CHECK, 326a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block STRING_CHECK, 327a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block NUMBER_CHECK, 328a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block BOOLEAN_CHECK, 329a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSARRAY_HAS_FAST_ELEMENTS_CHECK 330a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block }; 331a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 332a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block StubCompiler() : scope_(), masm_(NULL, 256), failure_(NULL) { } 333a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 334a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallInitialize(Code::Flags flags); 335a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallPreMonomorphic(Code::Flags flags); 336a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallNormal(Code::Flags flags); 337a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallMegamorphic(Code::Flags flags); 338a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallMiss(Code::Flags flags); 339a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#ifdef ENABLE_DEBUGGER_SUPPORT 340a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallDebugBreak(Code::Flags flags); 341a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallDebugPrepareStepIn(Code::Flags flags); 342a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#endif 343a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLazyCompile(Code::Flags flags); 344a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 345a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Static functions for generating parts of stubs. 346a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, 347a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index, 348a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register prototype); 349a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateFastPropertyLoad(MacroAssembler* masm, 350a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register dst, Register src, 351a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, int index); 352a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 353a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateLoadArrayLength(MacroAssembler* masm, 354a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 355a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch, 356a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss_label); 357a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateLoadStringLength(MacroAssembler* masm, 358a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 359a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch, 360a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss_label); 361a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateLoadStringLength2(MacroAssembler* masm, 362a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 363a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch1, 364a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch2, 365a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss_label); 366a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateLoadFunctionPrototype(MacroAssembler* masm, 367a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 368a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch1, 369a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch2, 370a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss_label); 371a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateStoreField(MacroAssembler* masm, 372a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Builtins::Name storage_extend, 373a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* object, 374a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index, 375a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Map* transition, 376a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver_reg, 377a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register name_reg, 378a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch, 379a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss_label); 380a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block static void GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind); 381a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 382a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // Check the integrity of the prototype chain to make sure that the 383a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block // current IC is still valid. 384a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register CheckPrototypes(JSObject* object, 385a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register object_reg, 386a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 387a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register holder_reg, 388a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch, 389a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 390a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss); 391a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 392a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block protected: 393a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* GetCodeWithFlags(Code::Flags flags, const char* name); 394a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* GetCodeWithFlags(Code::Flags flags, String* name); 395a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 396a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block MacroAssembler* masm() { return &masm_; } 397a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void set_failure(Failure* failure) { failure_ = failure; } 398a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 399a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void GenerateLoadField(JSObject* object, 400a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 401a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 402a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch1, 403a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch2, 404a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index, 405a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 406a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss); 407a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 408a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void GenerateLoadCallback(JSObject* object, 409a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 410a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 411a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register name_reg, 412a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch1, 413a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch2, 414a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block AccessorInfo* callback, 415a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 416a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss); 417a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 418a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void GenerateLoadConstant(JSObject* object, 419a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 420a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 421a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch1, 422a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch2, 423a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* value, 424a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 425a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss); 426a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 427a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block void GenerateLoadInterceptor(JSObject* object, 428a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 429a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block LookupResult* lookup, 430a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register receiver, 431a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register name_reg, 432a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch1, 433a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Register scratch2, 434a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 435a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Label* miss); 436a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 437a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 438a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block HandleScope scope_; 439a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block MacroAssembler masm_; 440a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Failure* failure_; 441a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 442a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 443a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 444a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass LoadStubCompiler: public StubCompiler { 445a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 446a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadField(JSObject* object, 447a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 448a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index, 449a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 450a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadCallback(JSObject* object, 451a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 452a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block AccessorInfo* callback, 453a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 454a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadConstant(JSObject* object, 455a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 456a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* value, 457a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 458a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadInterceptor(JSObject* object, 459a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 460a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 461a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 462a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadGlobal(JSObject* object, 463a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block GlobalObject* holder, 464a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSGlobalPropertyCell* cell, 465a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 466a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block bool is_dont_delete); 467a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 468a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 469a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* GetCode(PropertyType type, String* name); 470a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 471a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 472a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 473a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass KeyedLoadStubCompiler: public StubCompiler { 474a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 475a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadField(String* name, 476a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* object, 477a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 478a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index); 479a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadCallback(String* name, 480a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* object, 481a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 482a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block AccessorInfo* callback); 483a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadConstant(String* name, 484a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* object, 485a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 486a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* value); 487a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadInterceptor(JSObject* object, 488a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 489a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 490a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadArrayLength(String* name); 491a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadStringLength(String* name); 492a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileLoadFunctionPrototype(String* name); 493a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 494a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 495a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* GetCode(PropertyType type, String* name); 496a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 497a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 498a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 499a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass StoreStubCompiler: public StubCompiler { 500a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 501a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileStoreField(JSObject* object, 502a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index, 503a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Map* transition, 504a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 505a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileStoreCallback(JSObject* object, 506a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block AccessorInfo* callbacks, 507a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 508a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileStoreInterceptor(JSObject* object, String* name); 509a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileStoreGlobal(GlobalObject* object, 510a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSGlobalPropertyCell* holder, 511a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 512a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 513a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 514a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 515a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* GetCode(PropertyType type, String* name); 516a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 517a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 518a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 519a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass KeyedStoreStubCompiler: public StubCompiler { 520a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 521a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileStoreField(JSObject* object, 522a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index, 523a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Map* transition, 524a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 525a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 526a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 527a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* GetCode(PropertyType type, String* name); 528a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 529a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 530a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 531a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass CallStubCompiler: public StubCompiler { 532a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 533a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block explicit CallStubCompiler(int argc, InLoopFlag in_loop) 534a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block : arguments_(argc), in_loop_(in_loop) { } 535a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 536a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallField(Object* object, 537a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 538a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block int index, 539a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 540a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallConstant(Object* object, 541a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 542a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSFunction* function, 543a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name, 544a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block CheckType check); 545a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallInterceptor(Object* object, 546a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSObject* holder, 547a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 548a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileCallGlobal(JSObject* object, 549a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block GlobalObject* holder, 550a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSGlobalPropertyCell* cell, 551a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block JSFunction* function, 552a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block String* name); 553a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 554a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 555a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block const ParameterCount arguments_; 556a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block const InLoopFlag in_loop_; 557a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 558a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block const ParameterCount& arguments() { return arguments_; } 559a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 560a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* GetCode(PropertyType type, String* name); 561a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 562a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 563a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 564a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Blockclass ConstructStubCompiler: public StubCompiler { 565a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block public: 566a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block explicit ConstructStubCompiler() {} 567a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 568a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* CompileConstructStub(SharedFunctionInfo* shared); 569a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 570a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block private: 571a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block Object* GetCode(); 572a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block}; 573a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 574a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 575a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block} } // namespace v8::internal 576a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block 577a7e24c173cf37484693b9abb38e494fa7bd7baebSteve Block#endif // V8_STUB_CACHE_H_ 578