Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_STUB_CACHE_H_ | 5 #ifndef V8_STUB_CACHE_H_ |
| 6 #define V8_STUB_CACHE_H_ | 6 #define V8_STUB_CACHE_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 default: | 282 default: |
| 283 UNREACHABLE(); | 283 UNREACHABLE(); |
| 284 } | 284 } |
| 285 return Builtins::kLoadIC_Miss; | 285 return Builtins::kLoadIC_Miss; |
| 286 } | 286 } |
| 287 | 287 |
| 288 static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name); | 288 static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name); |
| 289 | 289 |
| 290 protected: | 290 protected: |
| 291 PropertyAccessCompiler(Isolate* isolate, Code::Kind kind, | 291 PropertyAccessCompiler(Isolate* isolate, Code::Kind kind, |
| 292 ExtraICState extra_ic_state, | |
| 293 CacheHolderFlag cache_holder) | 292 CacheHolderFlag cache_holder) |
| 294 : registers_(GetCallingConvention(kind)), | 293 : registers_(GetCallingConvention(kind)), |
| 295 kind_(kind), | 294 kind_(kind), |
| 296 cache_holder_(cache_holder), | 295 cache_holder_(cache_holder), |
| 297 isolate_(isolate), | 296 isolate_(isolate), |
| 298 extra_ic_state_(extra_ic_state), | |
| 299 masm_(isolate, NULL, 256) {} | 297 masm_(isolate, NULL, 256) {} |
| 300 | 298 |
| 301 Code::Kind kind() const { return kind_; } | 299 Code::Kind kind() const { return kind_; } |
| 302 CacheHolderFlag cache_holder() const { return cache_holder_; } | 300 CacheHolderFlag cache_holder() const { return cache_holder_; } |
| 303 ExtraICState extra_state() const { return extra_ic_state_; } | |
| 304 MacroAssembler* masm() { return &masm_; } | 301 MacroAssembler* masm() { return &masm_; } |
| 305 Isolate* isolate() const { return isolate_; } | 302 Isolate* isolate() const { return isolate_; } |
| 306 Heap* heap() const { return isolate()->heap(); } | 303 Heap* heap() const { return isolate()->heap(); } |
| 307 Factory* factory() const { return isolate()->factory(); } | 304 Factory* factory() const { return isolate()->factory(); } |
| 308 | 305 |
| 309 Register receiver() const { return registers_[0]; } | 306 Register receiver() const { return registers_[0]; } |
| 310 Register name() const { return registers_[1]; } | 307 Register name() const { return registers_[1]; } |
| 311 Register scratch1() const { return registers_[2]; } | 308 Register scratch1() const { return registers_[2]; } |
| 312 Register scratch2() const { return registers_[3]; } | 309 Register scratch2() const { return registers_[3]; } |
| 313 Register scratch3() const { return registers_[4]; } | 310 Register scratch3() const { return registers_[4]; } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 325 static void GenerateTailCall(MacroAssembler* masm, Handle<Code> code); | 322 static void GenerateTailCall(MacroAssembler* masm, Handle<Code> code); |
| 326 | 323 |
| 327 Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name); | 324 Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name); |
| 328 Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<Name> name); | 325 Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<Name> name); |
| 329 | 326 |
| 330 private: | 327 private: |
| 331 Code::Kind kind_; | 328 Code::Kind kind_; |
| 332 CacheHolderFlag cache_holder_; | 329 CacheHolderFlag cache_holder_; |
| 333 | 330 |
| 334 Isolate* isolate_; | 331 Isolate* isolate_; |
| 335 const ExtraICState extra_ic_state_; | |
| 336 MacroAssembler masm_; | 332 MacroAssembler masm_; |
| 337 }; | 333 }; |
| 338 | 334 |
| 339 | 335 |
| 340 class PropertyICCompiler : public PropertyAccessCompiler { | 336 class PropertyICCompiler : public PropertyAccessCompiler { |
| 341 public: | 337 public: |
| 342 PropertyICCompiler(Isolate* isolate, Code::Kind kind, | 338 PropertyICCompiler(Isolate* isolate, Code::Kind kind, |
| 343 ExtraICState extra_ic_state = kNoExtraICState, | 339 ExtraICState extra_ic_state = kNoExtraICState, |
| 344 CacheHolderFlag cache_holder = kCacheOnReceiver) | 340 CacheHolderFlag cache_holder = kCacheOnReceiver) |
| 345 : PropertyAccessCompiler(isolate, kind, extra_ic_state, cache_holder) {} | 341 : PropertyAccessCompiler(isolate, kind, cache_holder), |
| 342 extra_ic_state_(extra_ic_state) {} | |
| 346 | 343 |
| 347 static Handle<Code> Find(Handle<Name> name, Handle<Map> stub_holder_map, | 344 static Handle<Code> Find(Handle<Name> name, Handle<Map> stub_holder_map, |
| 348 Code::Kind kind, | 345 Code::Kind kind, |
| 349 ExtraICState extra_state = kNoExtraICState, | 346 ExtraICState extra_ic_state = kNoExtraICState, |
| 350 CacheHolderFlag cache_holder = kCacheOnReceiver); | 347 CacheHolderFlag cache_holder = kCacheOnReceiver); |
| 351 | 348 |
| 352 Handle<Code> CompileLoadInitialize(Code::Flags flags); | 349 Handle<Code> CompileLoadInitialize(Code::Flags flags); |
| 353 Handle<Code> CompileLoadPreMonomorphic(Code::Flags flags); | 350 Handle<Code> CompileLoadPreMonomorphic(Code::Flags flags); |
| 354 Handle<Code> CompileLoadMegamorphic(Code::Flags flags); | 351 Handle<Code> CompileLoadMegamorphic(Code::Flags flags); |
| 355 Handle<Code> CompileStoreInitialize(Code::Flags flags); | 352 Handle<Code> CompileStoreInitialize(Code::Flags flags); |
| 356 Handle<Code> CompileStorePreMonomorphic(Code::Flags flags); | 353 Handle<Code> CompileStorePreMonomorphic(Code::Flags flags); |
| 357 Handle<Code> CompileStoreGeneric(Code::Flags flags); | 354 Handle<Code> CompileStoreGeneric(Code::Flags flags); |
| 358 Handle<Code> CompileStoreMegamorphic(Code::Flags flags); | 355 Handle<Code> CompileStoreMegamorphic(Code::Flags flags); |
| 359 | 356 |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 390 ASSERT_EQ(Code::KEYED_STORE_IC, kind()); | 387 ASSERT_EQ(Code::KEYED_STORE_IC, kind()); |
| 391 return code->ic_state() == MONOMORPHIC | 388 return code->ic_state() == MONOMORPHIC |
| 392 ? Logger::KEYED_STORE_IC_TAG | 389 ? Logger::KEYED_STORE_IC_TAG |
| 393 : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; | 390 : Logger::KEYED_STORE_POLYMORPHIC_IC_TAG; |
| 394 } | 391 } |
| 395 } | 392 } |
| 396 | 393 |
| 397 Handle<Code> CompileIndexedStorePolymorphic(MapHandleList* receiver_maps, | 394 Handle<Code> CompileIndexedStorePolymorphic(MapHandleList* receiver_maps, |
| 398 CodeHandleList* handler_stubs, | 395 CodeHandleList* handler_stubs, |
| 399 MapHandleList* transitioned_maps); | 396 MapHandleList* transitioned_maps); |
| 397 const ExtraICState extra_ic_state_; | |
| 400 }; | 398 }; |
| 401 | 399 |
| 402 | 400 |
| 403 class PropertyHandlerCompiler : public PropertyAccessCompiler { | 401 class PropertyHandlerCompiler : public PropertyAccessCompiler { |
| 404 public: | 402 public: |
| 405 static Handle<Code> Find(Handle<Name> name, Handle<Map> map, Code::Kind kind, | 403 static Handle<Code> Find(Handle<Name> name, Handle<Map> map, Code::Kind kind, |
| 406 CacheHolderFlag cache_holder, Code::StubType type); | 404 CacheHolderFlag cache_holder, Code::StubType type); |
| 407 | 405 |
| 408 protected: | 406 protected: |
| 409 PropertyHandlerCompiler(Isolate* isolate, Code::Kind kind, | 407 PropertyHandlerCompiler(Isolate* isolate, Code::Kind kind, |
| 410 ExtraICState extra_ic_state, | |
| 411 CacheHolderFlag cache_holder) | 408 CacheHolderFlag cache_holder) |
| 412 : PropertyAccessCompiler(isolate, kind, extra_ic_state, cache_holder) {} | 409 : PropertyAccessCompiler(isolate, kind, cache_holder) {} |
| 413 | 410 |
| 414 virtual ~PropertyHandlerCompiler() {} | 411 virtual ~PropertyHandlerCompiler() {} |
| 415 | 412 |
| 416 virtual Register FrontendHeader(Handle<HeapType> type, Register object_reg, | 413 virtual Register FrontendHeader(Handle<HeapType> type, Register object_reg, |
| 417 Handle<JSObject> holder, Handle<Name> name, | 414 Handle<JSObject> holder, Handle<Name> name, |
| 418 Label* miss) { | 415 Label* miss) { |
| 419 UNREACHABLE(); | 416 UNREACHABLE(); |
| 420 return receiver(); | 417 return receiver(); |
| 421 } | 418 } |
| 422 | 419 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 474 Handle<Name> name, | 471 Handle<Name> name, |
| 475 Label* miss, | 472 Label* miss, |
| 476 PrototypeCheckType check = CHECK_ALL_MAPS); | 473 PrototypeCheckType check = CHECK_ALL_MAPS); |
| 477 | 474 |
| 478 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name); | 475 Handle<Code> GetCode(Code::Kind kind, Code::StubType type, Handle<Name> name); |
| 479 }; | 476 }; |
| 480 | 477 |
| 481 | 478 |
| 482 class NamedLoadHandlerCompiler : public PropertyHandlerCompiler { | 479 class NamedLoadHandlerCompiler : public PropertyHandlerCompiler { |
| 483 public: | 480 public: |
| 484 NamedLoadHandlerCompiler(Isolate* isolate, Code::Kind kind = Code::LOAD_IC, | 481 NamedLoadHandlerCompiler(Isolate* isolate, |
| 485 ExtraICState extra_ic_state = kNoExtraICState, | |
| 486 CacheHolderFlag cache_holder = kCacheOnReceiver) | 482 CacheHolderFlag cache_holder = kCacheOnReceiver) |
| 487 : PropertyHandlerCompiler(isolate, kind, extra_ic_state, cache_holder) {} | 483 : PropertyHandlerCompiler(isolate, Code::LOAD_IC, cache_holder) {} |
| 488 | 484 |
| 489 virtual ~NamedLoadHandlerCompiler() {} | 485 virtual ~NamedLoadHandlerCompiler() {} |
| 490 | 486 |
| 491 Handle<Code> CompileLoadField(Handle<HeapType> type, | 487 Handle<Code> CompileLoadField(Handle<HeapType> type, |
| 492 Handle<JSObject> holder, | 488 Handle<JSObject> holder, |
| 493 Handle<Name> name, | 489 Handle<Name> name, |
| 494 FieldIndex index, | 490 FieldIndex index, |
| 495 Representation representation); | 491 Representation representation); |
| 496 | 492 |
| 497 Handle<Code> CompileLoadCallback(Handle<HeapType> type, | 493 Handle<Code> CompileLoadCallback(Handle<HeapType> type, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 Register prototype, | 583 Register prototype, |
| 588 Label* miss); | 584 Label* miss); |
| 589 | 585 |
| 590 | 586 |
| 591 Register scratch4() { return registers_[5]; } | 587 Register scratch4() { return registers_[5]; } |
| 592 }; | 588 }; |
| 593 | 589 |
| 594 | 590 |
| 595 class NamedStoreHandlerCompiler : public PropertyHandlerCompiler { | 591 class NamedStoreHandlerCompiler : public PropertyHandlerCompiler { |
| 596 public: | 592 public: |
| 597 NamedStoreHandlerCompiler(Isolate* isolate, Code::Kind kind = Code::STORE_IC) | 593 explicit NamedStoreHandlerCompiler(Isolate* isolate) |
| 598 // Handlers do not use strict mode. | 594 // Handlers do not use strict mode. |
|
Igor Sheludko
2014/07/28 08:35:58
Does this comment still make sense?
| |
| 599 : PropertyHandlerCompiler(isolate, kind, kNoExtraICState, | 595 : PropertyHandlerCompiler(isolate, Code::STORE_IC, kCacheOnReceiver) {} |
| 600 kCacheOnReceiver) {} | |
| 601 | 596 |
| 602 virtual ~NamedStoreHandlerCompiler() {} | 597 virtual ~NamedStoreHandlerCompiler() {} |
| 603 | 598 |
| 604 Handle<Code> CompileStoreTransition(Handle<JSObject> object, | 599 Handle<Code> CompileStoreTransition(Handle<JSObject> object, |
| 605 LookupResult* lookup, | 600 LookupResult* lookup, |
| 606 Handle<Map> transition, | 601 Handle<Map> transition, |
| 607 Handle<Name> name); | 602 Handle<Name> name); |
| 608 | 603 |
| 609 Handle<Code> CompileStoreField(Handle<JSObject> object, | 604 Handle<Code> CompileStoreField(Handle<JSObject> object, |
| 610 LookupResult* lookup, | 605 LookupResult* lookup, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 689 } | 684 } |
| 690 return Builtins::kStoreIC_Slow; | 685 return Builtins::kStoreIC_Slow; |
| 691 } | 686 } |
| 692 | 687 |
| 693 static Register value(); | 688 static Register value(); |
| 694 }; | 689 }; |
| 695 | 690 |
| 696 | 691 |
| 697 class IndexedHandlerCompiler : public PropertyHandlerCompiler { | 692 class IndexedHandlerCompiler : public PropertyHandlerCompiler { |
| 698 public: | 693 public: |
| 699 IndexedHandlerCompiler(Isolate* isolate, | 694 explicit IndexedHandlerCompiler(Isolate* isolate) |
| 700 ExtraICState extra_ic_state = kNoExtraICState) | 695 : PropertyHandlerCompiler(isolate, Code::KEYED_LOAD_IC, |
| 701 : PropertyHandlerCompiler(isolate, Code::KEYED_LOAD_IC, extra_ic_state, | |
| 702 kCacheOnReceiver) {} | 696 kCacheOnReceiver) {} |
| 703 | 697 |
| 704 virtual ~IndexedHandlerCompiler() {} | 698 virtual ~IndexedHandlerCompiler() {} |
| 705 | 699 |
| 706 void CompileElementHandlers(MapHandleList* receiver_maps, | 700 void CompileElementHandlers(MapHandleList* receiver_maps, |
| 707 CodeHandleList* handlers); | 701 CodeHandleList* handlers); |
| 708 | 702 |
| 709 static void GenerateLoadDictionaryElement(MacroAssembler* masm); | 703 static void GenerateLoadDictionaryElement(MacroAssembler* masm); |
| 710 static void GenerateStoreDictionaryElement(MacroAssembler* masm); | 704 static void GenerateStoreDictionaryElement(MacroAssembler* masm); |
| 711 }; | 705 }; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 764 Handle<JSFunction> constant_function_; | 758 Handle<JSFunction> constant_function_; |
| 765 bool is_simple_api_call_; | 759 bool is_simple_api_call_; |
| 766 Handle<FunctionTemplateInfo> expected_receiver_type_; | 760 Handle<FunctionTemplateInfo> expected_receiver_type_; |
| 767 Handle<CallHandlerInfo> api_call_info_; | 761 Handle<CallHandlerInfo> api_call_info_; |
| 768 }; | 762 }; |
| 769 | 763 |
| 770 | 764 |
| 771 } } // namespace v8::internal | 765 } } // namespace v8::internal |
| 772 | 766 |
| 773 #endif // V8_STUB_CACHE_H_ | 767 #endif // V8_STUB_CACHE_H_ |
| OLD | NEW |