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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 JSObject* object, | 402 JSObject* object, |
403 int index, | 403 int index, |
404 Map* transition, | 404 Map* transition, |
405 Register receiver_reg, | 405 Register receiver_reg, |
406 Register name_reg, | 406 Register name_reg, |
407 Register scratch, | 407 Register scratch, |
408 Label* miss_label); | 408 Label* miss_label); |
409 | 409 |
410 static void GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind); | 410 static void GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind); |
411 | 411 |
412 // Check the integrity of the prototype chain to make sure that the | 412 // Generates code that verifies that the property holder has not changed |
413 // current IC is still valid. | 413 // (checking maps of objects in the prototype chain for fast and global |
| 414 // objects or doing negative lookup for slow objects, ensures that the |
| 415 // property cells for global objects are still empty) and checks that the map |
| 416 // of the holder has not changed. If necessary the function also generates |
| 417 // code for security check in case of global object holders. Helps to make |
| 418 // sure that the current IC is still valid. |
| 419 // |
| 420 // The scratch and holder registers are always clobbered, but the object |
| 421 // register is only clobbered if it the same as the holder register. The |
| 422 // function returns a register containing the holder - either object_reg or |
| 423 // holder_reg. |
| 424 // The function can optionally (when save_at_depth != |
| 425 // kInvalidProtoDepth) save the object at the given depth by moving |
| 426 // it to [esp + kPointerSize]. |
414 | 427 |
415 Register CheckPrototypes(JSObject* object, | 428 Register CheckPrototypes(JSObject* object, |
416 Register object_reg, | 429 Register object_reg, |
417 JSObject* holder, | 430 JSObject* holder, |
418 Register holder_reg, | 431 Register holder_reg, |
419 Register scratch, | 432 Register scratch, |
420 String* name, | 433 String* name, |
421 Label* miss) { | 434 Label* miss, |
| 435 Register extra = no_reg) { |
422 return CheckPrototypes(object, object_reg, holder, holder_reg, scratch, | 436 return CheckPrototypes(object, object_reg, holder, holder_reg, scratch, |
423 name, kInvalidProtoDepth, miss); | 437 name, kInvalidProtoDepth, miss, extra); |
424 } | 438 } |
425 | 439 |
426 Register CheckPrototypes(JSObject* object, | 440 Register CheckPrototypes(JSObject* object, |
427 Register object_reg, | 441 Register object_reg, |
428 JSObject* holder, | 442 JSObject* holder, |
429 Register holder_reg, | 443 Register holder_reg, |
430 Register scratch, | 444 Register scratch, |
431 String* name, | 445 String* name, |
432 int save_at_depth, | 446 int save_at_depth, |
433 Label* miss); | 447 Label* miss, |
| 448 Register extra = no_reg); |
434 | 449 |
435 protected: | 450 protected: |
436 Object* GetCodeWithFlags(Code::Flags flags, const char* name); | 451 Object* GetCodeWithFlags(Code::Flags flags, const char* name); |
437 Object* GetCodeWithFlags(Code::Flags flags, String* name); | 452 Object* GetCodeWithFlags(Code::Flags flags, String* name); |
438 | 453 |
439 MacroAssembler* masm() { return &masm_; } | 454 MacroAssembler* masm() { return &masm_; } |
440 void set_failure(Failure* failure) { failure_ = failure; } | 455 void set_failure(Failure* failure) { failure_ = failure; } |
441 | 456 |
442 void GenerateLoadField(JSObject* object, | 457 void GenerateLoadField(JSObject* object, |
443 JSObject* holder, | 458 JSObject* holder, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 class CallStubCompiler: public StubCompiler { | 621 class CallStubCompiler: public StubCompiler { |
607 public: | 622 public: |
608 enum { | 623 enum { |
609 #define DECLARE_CALL_GENERATOR_ID(ignored1, ignored2, name) \ | 624 #define DECLARE_CALL_GENERATOR_ID(ignored1, ignored2, name) \ |
610 k##name##CallGenerator, | 625 k##name##CallGenerator, |
611 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID) | 626 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR_ID) |
612 #undef DECLARE_CALL_GENERATOR_ID | 627 #undef DECLARE_CALL_GENERATOR_ID |
613 kNumCallGenerators | 628 kNumCallGenerators |
614 }; | 629 }; |
615 | 630 |
616 CallStubCompiler(int argc, InLoopFlag in_loop, Code::Kind kind) | 631 CallStubCompiler(int argc, |
617 : arguments_(argc), in_loop_(in_loop), kind_(kind) { } | 632 InLoopFlag in_loop, |
| 633 Code::Kind kind, |
| 634 InlineCacheHolderFlag cache_holder); |
618 | 635 |
619 Object* CompileCallField(JSObject* object, | 636 Object* CompileCallField(JSObject* object, |
620 JSObject* holder, | 637 JSObject* holder, |
621 int index, | 638 int index, |
622 String* name); | 639 String* name); |
623 Object* CompileCallConstant(Object* object, | 640 Object* CompileCallConstant(Object* object, |
624 JSObject* holder, | 641 JSObject* holder, |
625 JSFunction* function, | 642 JSFunction* function, |
626 String* name, | 643 String* name, |
627 CheckType check); | 644 CheckType check); |
(...skipping 20 matching lines...) Expand all Loading... |
648 JSFunction* function, \ | 665 JSFunction* function, \ |
649 String* fname, \ | 666 String* fname, \ |
650 CheckType check); | 667 CheckType check); |
651 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) | 668 CUSTOM_CALL_IC_GENERATORS(DECLARE_CALL_GENERATOR) |
652 #undef DECLARE_CALL_GENERATOR | 669 #undef DECLARE_CALL_GENERATOR |
653 | 670 |
654 private: | 671 private: |
655 const ParameterCount arguments_; | 672 const ParameterCount arguments_; |
656 const InLoopFlag in_loop_; | 673 const InLoopFlag in_loop_; |
657 const Code::Kind kind_; | 674 const Code::Kind kind_; |
| 675 const InlineCacheHolderFlag cache_holder_; |
658 | 676 |
659 const ParameterCount& arguments() { return arguments_; } | 677 const ParameterCount& arguments() { return arguments_; } |
660 | 678 |
661 Object* GetCode(PropertyType type, String* name); | 679 Object* GetCode(PropertyType type, String* name); |
662 | 680 |
663 // Convenience function. Calls GetCode above passing | 681 // Convenience function. Calls GetCode above passing |
664 // CONSTANT_FUNCTION type and the name of the given function. | 682 // CONSTANT_FUNCTION type and the name of the given function. |
665 Object* GetCode(JSFunction* function); | 683 Object* GetCode(JSFunction* function); |
666 | 684 |
667 void GenerateNameCheck(String* name, Label* miss); | 685 void GenerateNameCheck(String* name, Label* miss); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 | 743 |
726 JSFunction* constant_function_; | 744 JSFunction* constant_function_; |
727 bool is_simple_api_call_; | 745 bool is_simple_api_call_; |
728 FunctionTemplateInfo* expected_receiver_type_; | 746 FunctionTemplateInfo* expected_receiver_type_; |
729 CallHandlerInfo* api_call_info_; | 747 CallHandlerInfo* api_call_info_; |
730 }; | 748 }; |
731 | 749 |
732 } } // namespace v8::internal | 750 } } // namespace v8::internal |
733 | 751 |
734 #endif // V8_STUB_CACHE_H_ | 752 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |