| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 static Object* ComputeKeyedStoreField(String* name, | 136 static Object* ComputeKeyedStoreField(String* name, |
| 137 JSObject* receiver, | 137 JSObject* receiver, |
| 138 int field_index, | 138 int field_index, |
| 139 Map* transition = NULL); | 139 Map* transition = NULL); |
| 140 | 140 |
| 141 // --- | 141 // --- |
| 142 | 142 |
| 143 static Object* ComputeCallField(int argc, | 143 static Object* ComputeCallField(int argc, |
| 144 InLoopFlag in_loop, | 144 InLoopFlag in_loop, |
| 145 Code::Kind, |
| 145 String* name, | 146 String* name, |
| 146 Object* object, | 147 Object* object, |
| 147 JSObject* holder, | 148 JSObject* holder, |
| 148 int index); | 149 int index); |
| 149 | 150 |
| 150 static Object* ComputeCallConstant(int argc, | 151 static Object* ComputeCallConstant(int argc, |
| 151 InLoopFlag in_loop, | 152 InLoopFlag in_loop, |
| 153 Code::Kind, |
| 152 String* name, | 154 String* name, |
| 153 Object* object, | 155 Object* object, |
| 154 JSObject* holder, | 156 JSObject* holder, |
| 155 JSFunction* function); | 157 JSFunction* function); |
| 156 | 158 |
| 157 static Object* ComputeCallNormal(int argc, | 159 static Object* ComputeCallNormal(int argc, |
| 158 InLoopFlag in_loop, | 160 InLoopFlag in_loop, |
| 161 Code::Kind, |
| 159 String* name, | 162 String* name, |
| 160 JSObject* receiver); | 163 JSObject* receiver); |
| 161 | 164 |
| 162 static Object* ComputeCallInterceptor(int argc, | 165 static Object* ComputeCallInterceptor(int argc, |
| 166 Code::Kind, |
| 163 String* name, | 167 String* name, |
| 164 Object* object, | 168 Object* object, |
| 165 JSObject* holder); | 169 JSObject* holder); |
| 166 | 170 |
| 167 static Object* ComputeCallGlobal(int argc, | 171 static Object* ComputeCallGlobal(int argc, |
| 168 InLoopFlag in_loop, | 172 InLoopFlag in_loop, |
| 173 Code::Kind, |
| 169 String* name, | 174 String* name, |
| 170 JSObject* receiver, | 175 JSObject* receiver, |
| 171 GlobalObject* holder, | 176 GlobalObject* holder, |
| 172 JSGlobalPropertyCell* cell, | 177 JSGlobalPropertyCell* cell, |
| 173 JSFunction* function); | 178 JSFunction* function); |
| 174 | 179 |
| 175 // --- | 180 // --- |
| 176 | 181 |
| 177 static Object* ComputeCallInitialize(int argc, InLoopFlag in_loop); | 182 static Object* ComputeCallInitialize(int argc, |
| 178 static Object* ComputeCallPreMonomorphic(int argc, InLoopFlag in_loop); | 183 InLoopFlag in_loop, |
| 179 static Object* ComputeCallNormal(int argc, InLoopFlag in_loop); | 184 Code::Kind kind); |
| 180 static Object* ComputeCallMegamorphic(int argc, InLoopFlag in_loop); | 185 |
| 181 static Object* ComputeCallMiss(int argc); | 186 static Object* ComputeCallPreMonomorphic(int argc, |
| 187 InLoopFlag in_loop, |
| 188 Code::Kind kind); |
| 189 |
| 190 static Object* ComputeCallNormal(int argc, |
| 191 InLoopFlag in_loop, |
| 192 Code::Kind kind); |
| 193 |
| 194 static Object* ComputeCallMegamorphic(int argc, |
| 195 InLoopFlag in_loop, |
| 196 Code::Kind kind); |
| 197 |
| 198 static Object* ComputeCallMiss(int argc, Code::Kind kind); |
| 182 | 199 |
| 183 // Finds the Code object stored in the Heap::non_monomorphic_cache(). | 200 // Finds the Code object stored in the Heap::non_monomorphic_cache(). |
| 184 static Code* FindCallInitialize(int argc, InLoopFlag in_loop); | 201 static Code* FindCallInitialize(int argc, |
| 202 InLoopFlag in_loop, |
| 203 Code::Kind kind); |
| 185 | 204 |
| 186 #ifdef ENABLE_DEBUGGER_SUPPORT | 205 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 187 static Object* ComputeCallDebugBreak(int argc); | 206 static Object* ComputeCallDebugBreak(int argc, Code::Kind kind); |
| 188 static Object* ComputeCallDebugPrepareStepIn(int argc); | 207 |
| 208 static Object* ComputeCallDebugPrepareStepIn(int argc, Code::Kind kind); |
| 189 #endif | 209 #endif |
| 190 | 210 |
| 191 static Object* ComputeLazyCompile(int argc); | 211 static Object* ComputeLazyCompile(int argc); |
| 192 | 212 |
| 193 | 213 |
| 194 // Update cache for entry hash(name, map). | 214 // Update cache for entry hash(name, map). |
| 195 static Code* Set(String* name, Map* map, Code* code); | 215 static Code* Set(String* name, Map* map, Code* code); |
| 196 | 216 |
| 197 // Clear the lookup table (@ mark compact collection). | 217 // Clear the lookup table (@ mark compact collection). |
| 198 static void Clear(); | 218 static void Clear(); |
| 199 | 219 |
| 200 // Functions for generating stubs at startup. | |
| 201 static void GenerateMiss(MacroAssembler* masm); | |
| 202 | |
| 203 // Generate code for probing the stub cache table. | 220 // Generate code for probing the stub cache table. |
| 204 // If extra != no_reg it might be used as am extra scratch register. | 221 // If extra != no_reg it might be used as am extra scratch register. |
| 205 static void GenerateProbe(MacroAssembler* masm, | 222 static void GenerateProbe(MacroAssembler* masm, |
| 206 Code::Flags flags, | 223 Code::Flags flags, |
| 207 Register receiver, | 224 Register receiver, |
| 208 Register name, | 225 Register name, |
| 209 Register scratch, | 226 Register scratch, |
| 210 Register extra); | 227 Register extra); |
| 211 | 228 |
| 212 enum Table { | 229 enum Table { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Support functions for IC stubs for interceptors. | 328 // Support functions for IC stubs for interceptors. |
| 312 Object* LoadPropertyWithInterceptorOnly(Arguments args); | 329 Object* LoadPropertyWithInterceptorOnly(Arguments args); |
| 313 Object* LoadPropertyWithInterceptorForLoad(Arguments args); | 330 Object* LoadPropertyWithInterceptorForLoad(Arguments args); |
| 314 Object* LoadPropertyWithInterceptorForCall(Arguments args); | 331 Object* LoadPropertyWithInterceptorForCall(Arguments args); |
| 315 Object* StoreInterceptorProperty(Arguments args); | 332 Object* StoreInterceptorProperty(Arguments args); |
| 316 Object* CallInterceptorProperty(Arguments args); | 333 Object* CallInterceptorProperty(Arguments args); |
| 317 Object* KeyedLoadPropertyWithInterceptor(Arguments args); | 334 Object* KeyedLoadPropertyWithInterceptor(Arguments args); |
| 318 | 335 |
| 319 | 336 |
| 320 // Support function for computing call IC miss stubs. | 337 // Support function for computing call IC miss stubs. |
| 321 Handle<Code> ComputeCallMiss(int argc); | 338 Handle<Code> ComputeCallMiss(int argc, Code::Kind kind); |
| 322 | 339 |
| 323 | 340 |
| 324 // The stub compiler compiles stubs for the stub cache. | 341 // The stub compiler compiles stubs for the stub cache. |
| 325 class StubCompiler BASE_EMBEDDED { | 342 class StubCompiler BASE_EMBEDDED { |
| 326 public: | 343 public: |
| 327 enum CheckType { | 344 enum CheckType { |
| 328 RECEIVER_MAP_CHECK, | 345 RECEIVER_MAP_CHECK, |
| 329 STRING_CHECK, | 346 STRING_CHECK, |
| 330 NUMBER_CHECK, | 347 NUMBER_CHECK, |
| 331 BOOLEAN_CHECK | 348 BOOLEAN_CHECK |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 class CallStubCompiler: public StubCompiler { | 595 class CallStubCompiler: public StubCompiler { |
| 579 public: | 596 public: |
| 580 enum { | 597 enum { |
| 581 #define DECLARE_CALL_GENERATOR_ID(ignored1, ignored2, name) \ | 598 #define DECLARE_CALL_GENERATOR_ID(ignored1, ignored2, name) \ |
| 582 k##name##CallGenerator, | 599 k##name##CallGenerator, |
| 583 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID) | 600 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID) |
| 584 #undef DECLARE_CALL_GENERATOR_ID | 601 #undef DECLARE_CALL_GENERATOR_ID |
| 585 kNumCallGenerators | 602 kNumCallGenerators |
| 586 }; | 603 }; |
| 587 | 604 |
| 588 CallStubCompiler(int argc, InLoopFlag in_loop) | 605 CallStubCompiler(int argc, InLoopFlag in_loop, Code::Kind kind) |
| 589 : arguments_(argc), in_loop_(in_loop) { } | 606 : arguments_(argc), in_loop_(in_loop), kind_(kind) { } |
| 590 | 607 |
| 591 Object* CompileCallField(JSObject* object, | 608 Object* CompileCallField(JSObject* object, |
| 592 JSObject* holder, | 609 JSObject* holder, |
| 593 int index, | 610 int index, |
| 594 String* name); | 611 String* name); |
| 595 Object* CompileCallConstant(Object* object, | 612 Object* CompileCallConstant(Object* object, |
| 596 JSObject* holder, | 613 JSObject* holder, |
| 597 JSFunction* function, | 614 JSFunction* function, |
| 598 String* name, | 615 String* name, |
| 599 CheckType check); | 616 CheckType check); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 619 JSObject* holder, \ | 636 JSObject* holder, \ |
| 620 JSFunction* function, \ | 637 JSFunction* function, \ |
| 621 String* fname, \ | 638 String* fname, \ |
| 622 CheckType check); | 639 CheckType check); |
| 623 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) | 640 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) |
| 624 #undef DECLARE_CALL_GENERATOR | 641 #undef DECLARE_CALL_GENERATOR |
| 625 | 642 |
| 626 private: | 643 private: |
| 627 const ParameterCount arguments_; | 644 const ParameterCount arguments_; |
| 628 const InLoopFlag in_loop_; | 645 const InLoopFlag in_loop_; |
| 646 const Code::Kind kind_; |
| 629 | 647 |
| 630 const ParameterCount& arguments() { return arguments_; } | 648 const ParameterCount& arguments() { return arguments_; } |
| 631 | 649 |
| 632 Object* GetCode(PropertyType type, String* name); | 650 Object* GetCode(PropertyType type, String* name); |
| 633 | 651 |
| 634 // Convenience function. Calls GetCode above passing | 652 // Convenience function. Calls GetCode above passing |
| 635 // CONSTANT_FUNCTION type and the name of the given function. | 653 // CONSTANT_FUNCTION type and the name of the given function. |
| 636 Object* GetCode(JSFunction* function); | 654 Object* GetCode(JSFunction* function); |
| 655 |
| 656 void GenerateNameCheck(String* name, Label* miss); |
| 657 |
| 658 void GenerateMissBranch(); |
| 637 }; | 659 }; |
| 638 | 660 |
| 639 | 661 |
| 640 class ConstructStubCompiler: public StubCompiler { | 662 class ConstructStubCompiler: public StubCompiler { |
| 641 public: | 663 public: |
| 642 explicit ConstructStubCompiler() {} | 664 explicit ConstructStubCompiler() {} |
| 643 | 665 |
| 644 Object* CompileConstructStub(SharedFunctionInfo* shared); | 666 Object* CompileConstructStub(SharedFunctionInfo* shared); |
| 645 | 667 |
| 646 private: | 668 private: |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 714 |
| 693 JSFunction* constant_function_; | 715 JSFunction* constant_function_; |
| 694 bool is_simple_api_call_; | 716 bool is_simple_api_call_; |
| 695 FunctionTemplateInfo* expected_receiver_type_; | 717 FunctionTemplateInfo* expected_receiver_type_; |
| 696 CallHandlerInfo* api_call_info_; | 718 CallHandlerInfo* api_call_info_; |
| 697 }; | 719 }; |
| 698 | 720 |
| 699 } } // namespace v8::internal | 721 } } // namespace v8::internal |
| 700 | 722 |
| 701 #endif // V8_STUB_CACHE_H_ | 723 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |