| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreElement( | 188 MUST_USE_RESULT MaybeObject* ComputeKeyedLoadOrStoreElement( |
| 189 JSObject* receiver, | 189 JSObject* receiver, |
| 190 bool is_store, | 190 bool is_store, |
| 191 StrictModeFlag strict_mode); | 191 StrictModeFlag strict_mode); |
| 192 | 192 |
| 193 // --- | 193 // --- |
| 194 | 194 |
| 195 MUST_USE_RESULT MaybeObject* ComputeCallField( | 195 MUST_USE_RESULT MaybeObject* ComputeCallField( |
| 196 int argc, | 196 int argc, |
| 197 InLoopFlag in_loop, | |
| 198 Code::Kind, | 197 Code::Kind, |
| 199 Code::ExtraICState extra_ic_state, | 198 Code::ExtraICState extra_ic_state, |
| 200 String* name, | 199 String* name, |
| 201 Object* object, | 200 Object* object, |
| 202 JSObject* holder, | 201 JSObject* holder, |
| 203 int index); | 202 int index); |
| 204 | 203 |
| 205 MUST_USE_RESULT MaybeObject* ComputeCallConstant( | 204 MUST_USE_RESULT MaybeObject* ComputeCallConstant( |
| 206 int argc, | 205 int argc, |
| 207 InLoopFlag in_loop, | |
| 208 Code::Kind, | 206 Code::Kind, |
| 209 Code::ExtraICState extra_ic_state, | 207 Code::ExtraICState extra_ic_state, |
| 210 String* name, | 208 String* name, |
| 211 Object* object, | 209 Object* object, |
| 212 JSObject* holder, | 210 JSObject* holder, |
| 213 JSFunction* function); | 211 JSFunction* function); |
| 214 | 212 |
| 215 MUST_USE_RESULT MaybeObject* ComputeCallNormal( | 213 MUST_USE_RESULT MaybeObject* ComputeCallNormal( |
| 216 int argc, | 214 int argc, |
| 217 InLoopFlag in_loop, | |
| 218 Code::Kind, | 215 Code::Kind, |
| 219 Code::ExtraICState extra_ic_state, | 216 Code::ExtraICState extra_ic_state, |
| 220 String* name, | 217 String* name, |
| 221 JSObject* receiver); | 218 JSObject* receiver); |
| 222 | 219 |
| 223 MUST_USE_RESULT MaybeObject* ComputeCallInterceptor( | 220 MUST_USE_RESULT MaybeObject* ComputeCallInterceptor( |
| 224 int argc, | 221 int argc, |
| 225 Code::Kind, | 222 Code::Kind, |
| 226 Code::ExtraICState extra_ic_state, | 223 Code::ExtraICState extra_ic_state, |
| 227 String* name, | 224 String* name, |
| 228 Object* object, | 225 Object* object, |
| 229 JSObject* holder); | 226 JSObject* holder); |
| 230 | 227 |
| 231 MUST_USE_RESULT MaybeObject* ComputeCallGlobal( | 228 MUST_USE_RESULT MaybeObject* ComputeCallGlobal( |
| 232 int argc, | 229 int argc, |
| 233 InLoopFlag in_loop, | |
| 234 Code::Kind, | 230 Code::Kind, |
| 235 Code::ExtraICState extra_ic_state, | 231 Code::ExtraICState extra_ic_state, |
| 236 String* name, | 232 String* name, |
| 237 JSObject* receiver, | 233 JSObject* receiver, |
| 238 GlobalObject* holder, | 234 GlobalObject* holder, |
| 239 JSGlobalPropertyCell* cell, | 235 JSGlobalPropertyCell* cell, |
| 240 JSFunction* function); | 236 JSFunction* function); |
| 241 | 237 |
| 242 // --- | 238 // --- |
| 243 | 239 |
| 244 MUST_USE_RESULT MaybeObject* ComputeCallInitialize(int argc, | 240 MUST_USE_RESULT MaybeObject* ComputeCallInitialize(int argc, |
| 245 InLoopFlag in_loop, | |
| 246 RelocInfo::Mode mode, | 241 RelocInfo::Mode mode, |
| 247 Code::Kind kind); | 242 Code::Kind kind); |
| 248 | 243 |
| 249 Handle<Code> ComputeCallInitialize(int argc, | 244 Handle<Code> ComputeCallInitialize(int argc, |
| 250 InLoopFlag in_loop, | |
| 251 RelocInfo::Mode mode); | 245 RelocInfo::Mode mode); |
| 252 | 246 |
| 253 Handle<Code> ComputeKeyedCallInitialize(int argc, InLoopFlag in_loop); | 247 Handle<Code> ComputeKeyedCallInitialize(int argc); |
| 254 | 248 |
| 255 MUST_USE_RESULT MaybeObject* ComputeCallPreMonomorphic( | 249 MUST_USE_RESULT MaybeObject* ComputeCallPreMonomorphic( |
| 256 int argc, | 250 int argc, |
| 257 InLoopFlag in_loop, | |
| 258 Code::Kind kind, | 251 Code::Kind kind, |
| 259 Code::ExtraICState extra_ic_state); | 252 Code::ExtraICState extra_ic_state); |
| 260 | 253 |
| 261 MUST_USE_RESULT MaybeObject* ComputeCallNormal(int argc, | 254 MUST_USE_RESULT MaybeObject* ComputeCallNormal(int argc, |
| 262 InLoopFlag in_loop, | |
| 263 Code::Kind kind, | 255 Code::Kind kind, |
| 264 Code::ExtraICState state); | 256 Code::ExtraICState state); |
| 265 | 257 |
| 266 MUST_USE_RESULT MaybeObject* ComputeCallArguments(int argc, | 258 MUST_USE_RESULT MaybeObject* ComputeCallArguments(int argc, |
| 267 InLoopFlag in_loop, | |
| 268 Code::Kind kind); | 259 Code::Kind kind); |
| 269 | 260 |
| 270 MUST_USE_RESULT MaybeObject* ComputeCallMegamorphic(int argc, | 261 MUST_USE_RESULT MaybeObject* ComputeCallMegamorphic(int argc, |
| 271 InLoopFlag in_loop, | |
| 272 Code::Kind kind, | 262 Code::Kind kind, |
| 273 Code::ExtraICState state); | 263 Code::ExtraICState state); |
| 274 | 264 |
| 275 MUST_USE_RESULT MaybeObject* ComputeCallMiss(int argc, | 265 MUST_USE_RESULT MaybeObject* ComputeCallMiss(int argc, |
| 276 Code::Kind kind, | 266 Code::Kind kind, |
| 277 Code::ExtraICState state); | 267 Code::ExtraICState state); |
| 278 | 268 |
| 279 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 269 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
| 280 MUST_USE_RESULT Code* FindCallInitialize(int argc, | 270 MUST_USE_RESULT Code* FindCallInitialize(int argc, |
| 281 InLoopFlag in_loop, | |
| 282 RelocInfo::Mode mode, | 271 RelocInfo::Mode mode, |
| 283 Code::Kind kind); | 272 Code::Kind kind); |
| 284 | 273 |
| 285 #ifdef ENABLE_DEBUGGER_SUPPORT | 274 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 286 MUST_USE_RESULT MaybeObject* ComputeCallDebugBreak(int argc, Code::Kind kind); | 275 MUST_USE_RESULT MaybeObject* ComputeCallDebugBreak(int argc, Code::Kind kind); |
| 287 | 276 |
| 288 MUST_USE_RESULT MaybeObject* ComputeCallDebugPrepareStepIn(int argc, | 277 MUST_USE_RESULT MaybeObject* ComputeCallDebugPrepareStepIn(int argc, |
| 289 Code::Kind kind); | 278 Code::Kind kind); |
| 290 #endif | 279 #endif |
| 291 | 280 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup); | 361 (static_cast<uint32_t>(flags) & ~Code::kFlagsNotUsedInLookup); |
| 373 // Base the offset on a simple combination of name, flags, and map. | 362 // Base the offset on a simple combination of name, flags, and map. |
| 374 uint32_t key = (map_low32bits + field) ^ iflags; | 363 uint32_t key = (map_low32bits + field) ^ iflags; |
| 375 return key & ((kPrimaryTableSize - 1) << kHeapObjectTagSize); | 364 return key & ((kPrimaryTableSize - 1) << kHeapObjectTagSize); |
| 376 } | 365 } |
| 377 | 366 |
| 378 static int SecondaryOffset(String* name, Code::Flags flags, int seed) { | 367 static int SecondaryOffset(String* name, Code::Flags flags, int seed) { |
| 379 // Use the seed from the primary cache in the secondary cache. | 368 // Use the seed from the primary cache in the secondary cache. |
| 380 uint32_t string_low32bits = | 369 uint32_t string_low32bits = |
| 381 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)); | 370 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name)); |
| 382 // We always set the in_loop bit to zero when generating the lookup code | 371 uint32_t key = seed - string_low32bits + flags; |
| 383 // so do it here too so the hash codes match. | |
| 384 uint32_t iflags = | |
| 385 (static_cast<uint32_t>(flags) & ~Code::ICInLoopField::kMask); | |
| 386 uint32_t key = seed - string_low32bits + iflags; | |
| 387 return key & ((kSecondaryTableSize - 1) << kHeapObjectTagSize); | 372 return key & ((kSecondaryTableSize - 1) << kHeapObjectTagSize); |
| 388 } | 373 } |
| 389 | 374 |
| 390 // Compute the entry for a given offset in exactly the same way as | 375 // Compute the entry for a given offset in exactly the same way as |
| 391 // we do in generated code. We generate an hash code that already | 376 // we do in generated code. We generate an hash code that already |
| 392 // ends in String::kHashShift 0s. Then we shift it so it is a multiple | 377 // ends in String::kHashShift 0s. Then we shift it so it is a multiple |
| 393 // of sizeof(Entry). This makes it easier to avoid making mistakes | 378 // of sizeof(Entry). This makes it easier to avoid making mistakes |
| 394 // in the hashed offset computations. | 379 // in the hashed offset computations. |
| 395 static Entry* entry(Entry* table, int offset) { | 380 static Entry* entry(Entry* table, int offset) { |
| 396 const int shift_amount = kPointerSizeLog2 + 1 - String::kHashShift; | 381 const int shift_amount = kPointerSizeLog2 + 1 - String::kHashShift; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 V(StringFromCharCode) \ | 733 V(StringFromCharCode) \ |
| 749 V(MathFloor) \ | 734 V(MathFloor) \ |
| 750 V(MathAbs) | 735 V(MathAbs) |
| 751 | 736 |
| 752 | 737 |
| 753 class CallOptimization; | 738 class CallOptimization; |
| 754 | 739 |
| 755 class CallStubCompiler: public StubCompiler { | 740 class CallStubCompiler: public StubCompiler { |
| 756 public: | 741 public: |
| 757 CallStubCompiler(int argc, | 742 CallStubCompiler(int argc, |
| 758 InLoopFlag in_loop, | |
| 759 Code::Kind kind, | 743 Code::Kind kind, |
| 760 Code::ExtraICState extra_ic_state, | 744 Code::ExtraICState extra_ic_state, |
| 761 InlineCacheHolderFlag cache_holder); | 745 InlineCacheHolderFlag cache_holder); |
| 762 | 746 |
| 763 MUST_USE_RESULT MaybeObject* CompileCallField( | 747 MUST_USE_RESULT MaybeObject* CompileCallField( |
| 764 JSObject* object, | 748 JSObject* object, |
| 765 JSObject* holder, | 749 JSObject* holder, |
| 766 int index, | 750 int index, |
| 767 String* name); | 751 String* name); |
| 768 | 752 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 | 792 |
| 809 MUST_USE_RESULT MaybeObject* CompileFastApiCall( | 793 MUST_USE_RESULT MaybeObject* CompileFastApiCall( |
| 810 const CallOptimization& optimization, | 794 const CallOptimization& optimization, |
| 811 Object* object, | 795 Object* object, |
| 812 JSObject* holder, | 796 JSObject* holder, |
| 813 JSGlobalPropertyCell* cell, | 797 JSGlobalPropertyCell* cell, |
| 814 JSFunction* function, | 798 JSFunction* function, |
| 815 String* name); | 799 String* name); |
| 816 | 800 |
| 817 const ParameterCount arguments_; | 801 const ParameterCount arguments_; |
| 818 const InLoopFlag in_loop_; | |
| 819 const Code::Kind kind_; | 802 const Code::Kind kind_; |
| 820 const Code::ExtraICState extra_ic_state_; | 803 const Code::ExtraICState extra_ic_state_; |
| 821 const InlineCacheHolderFlag cache_holder_; | 804 const InlineCacheHolderFlag cache_holder_; |
| 822 | 805 |
| 823 const ParameterCount& arguments() { return arguments_; } | 806 const ParameterCount& arguments() { return arguments_; } |
| 824 | 807 |
| 825 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); | 808 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); |
| 826 | 809 |
| 827 // Convenience function. Calls GetCode above passing | 810 // Convenience function. Calls GetCode above passing |
| 828 // CONSTANT_FUNCTION type and the name of the given function. | 811 // CONSTANT_FUNCTION type and the name of the given function. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 JSFunction* constant_function_; | 886 JSFunction* constant_function_; |
| 904 bool is_simple_api_call_; | 887 bool is_simple_api_call_; |
| 905 FunctionTemplateInfo* expected_receiver_type_; | 888 FunctionTemplateInfo* expected_receiver_type_; |
| 906 CallHandlerInfo* api_call_info_; | 889 CallHandlerInfo* api_call_info_; |
| 907 }; | 890 }; |
| 908 | 891 |
| 909 | 892 |
| 910 } } // namespace v8::internal | 893 } } // namespace v8::internal |
| 911 | 894 |
| 912 #endif // V8_STUB_CACHE_H_ | 895 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |