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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // has changed, a jump to miss is performed. This ties the generated | 409 // has changed, a jump to miss is performed. This ties the generated |
410 // code to a particular context and so must not be used in cases | 410 // code to a particular context and so must not be used in cases |
411 // where the generated code is not allowed to have references to | 411 // where the generated code is not allowed to have references to |
412 // objects from a context. | 412 // objects from a context. |
413 static void GenerateDirectLoadGlobalFunctionPrototype(MacroAssembler* masm, | 413 static void GenerateDirectLoadGlobalFunctionPrototype(MacroAssembler* masm, |
414 int index, | 414 int index, |
415 Register prototype, | 415 Register prototype, |
416 Label* miss); | 416 Label* miss); |
417 | 417 |
418 static void GenerateFastPropertyLoad(MacroAssembler* masm, | 418 static void GenerateFastPropertyLoad(MacroAssembler* masm, |
419 Register dst, Register src, | 419 Register dst, |
420 JSObject* holder, int index); | 420 Register src, |
| 421 Handle<JSObject> holder, |
| 422 int index); |
421 | 423 |
422 static void GenerateLoadArrayLength(MacroAssembler* masm, | 424 static void GenerateLoadArrayLength(MacroAssembler* masm, |
423 Register receiver, | 425 Register receiver, |
424 Register scratch, | 426 Register scratch, |
425 Label* miss_label); | 427 Label* miss_label); |
426 | 428 |
427 static void GenerateLoadStringLength(MacroAssembler* masm, | 429 static void GenerateLoadStringLength(MacroAssembler* masm, |
428 Register receiver, | 430 Register receiver, |
429 Register scratch1, | 431 Register scratch1, |
430 Register scratch2, | 432 Register scratch2, |
(...skipping 28 matching lines...) Expand all Loading... |
459 // code for security check in case of global object holders. Helps to make | 461 // code for security check in case of global object holders. Helps to make |
460 // sure that the current IC is still valid. | 462 // sure that the current IC is still valid. |
461 // | 463 // |
462 // The scratch and holder registers are always clobbered, but the object | 464 // The scratch and holder registers are always clobbered, but the object |
463 // register is only clobbered if it the same as the holder register. The | 465 // register is only clobbered if it the same as the holder register. The |
464 // function returns a register containing the holder - either object_reg or | 466 // function returns a register containing the holder - either object_reg or |
465 // holder_reg. | 467 // holder_reg. |
466 // The function can optionally (when save_at_depth != | 468 // The function can optionally (when save_at_depth != |
467 // kInvalidProtoDepth) save the object at the given depth by moving | 469 // kInvalidProtoDepth) save the object at the given depth by moving |
468 // it to [esp + kPointerSize]. | 470 // it to [esp + kPointerSize]. |
| 471 Register CheckPrototypes(Handle<JSObject> object, |
| 472 Register object_reg, |
| 473 Handle<JSObject> holder, |
| 474 Register holder_reg, |
| 475 Register scratch1, |
| 476 Register scratch2, |
| 477 Handle<String> name, |
| 478 Label* miss) { |
| 479 return CheckPrototypes(object, object_reg, holder, holder_reg, scratch1, |
| 480 scratch2, name, kInvalidProtoDepth, miss); |
| 481 } |
469 | 482 |
| 483 Register CheckPrototypes(Handle<JSObject> object, |
| 484 Register object_reg, |
| 485 Handle<JSObject> holder, |
| 486 Register holder_reg, |
| 487 Register scratch1, |
| 488 Register scratch2, |
| 489 Handle<String> name, |
| 490 int save_at_depth, |
| 491 Label* miss); |
| 492 |
| 493 // TODO(kmillikin): Eliminate this function when the stub cache is fully |
| 494 // handlified. |
470 Register CheckPrototypes(JSObject* object, | 495 Register CheckPrototypes(JSObject* object, |
471 Register object_reg, | 496 Register object_reg, |
472 JSObject* holder, | 497 JSObject* holder, |
473 Register holder_reg, | 498 Register holder_reg, |
474 Register scratch1, | 499 Register scratch1, |
475 Register scratch2, | 500 Register scratch2, |
476 String* name, | 501 String* name, |
477 Label* miss) { | 502 Label* miss) { |
478 return CheckPrototypes(object, object_reg, holder, holder_reg, scratch1, | 503 return CheckPrototypes(object, object_reg, holder, holder_reg, scratch1, |
479 scratch2, name, kInvalidProtoDepth, miss); | 504 scratch2, name, kInvalidProtoDepth, miss); |
480 } | 505 } |
481 | 506 |
| 507 // TODO(kmillikin): Eliminate this function when the stub cache is fully |
| 508 // handlified. |
482 Register CheckPrototypes(JSObject* object, | 509 Register CheckPrototypes(JSObject* object, |
483 Register object_reg, | 510 Register object_reg, |
484 JSObject* holder, | 511 JSObject* holder, |
485 Register holder_reg, | 512 Register holder_reg, |
486 Register scratch1, | 513 Register scratch1, |
487 Register scratch2, | 514 Register scratch2, |
488 String* name, | 515 String* name, |
489 int save_at_depth, | 516 int save_at_depth, |
490 Label* miss); | 517 Label* miss); |
491 | 518 |
492 protected: | 519 protected: |
493 Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name); | 520 Handle<Code> GetCodeWithFlags(Code::Flags flags, const char* name); |
| 521 Handle<Code> GetCodeWithFlags(Code::Flags flags, Handle<String> name); |
494 | 522 |
495 MUST_USE_RESULT MaybeObject* TryGetCodeWithFlags(Code::Flags flags, | 523 MUST_USE_RESULT MaybeObject* TryGetCodeWithFlags(Code::Flags flags, |
496 const char* name); | 524 const char* name); |
497 MUST_USE_RESULT MaybeObject* TryGetCodeWithFlags(Code::Flags flags, | 525 MUST_USE_RESULT MaybeObject* TryGetCodeWithFlags(Code::Flags flags, |
498 String* name); | 526 String* name); |
499 | 527 |
500 MacroAssembler* masm() { return &masm_; } | 528 MacroAssembler* masm() { return &masm_; } |
501 void set_failure(Failure* failure) { failure_ = failure; } | 529 void set_failure(Failure* failure) { failure_ = failure; } |
502 | 530 |
503 void GenerateLoadField(JSObject* object, | 531 void GenerateLoadField(JSObject* object, |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 int argc, | 847 int argc, |
820 Code::Kind kind, | 848 Code::Kind kind, |
821 Code::ExtraICState extra_state, | 849 Code::ExtraICState extra_state, |
822 InlineCacheHolderFlag cache_holder); | 850 InlineCacheHolderFlag cache_holder); |
823 | 851 |
824 Handle<Code> CompileCallField(Handle<JSObject> object, | 852 Handle<Code> CompileCallField(Handle<JSObject> object, |
825 Handle<JSObject> holder, | 853 Handle<JSObject> holder, |
826 int index, | 854 int index, |
827 Handle<String> name); | 855 Handle<String> name); |
828 | 856 |
829 MUST_USE_RESULT MaybeObject* CompileCallField(JSObject* object, | |
830 JSObject* holder, | |
831 int index, | |
832 String* name); | |
833 | |
834 Handle<Code> CompileCallConstant(Handle<Object> object, | 857 Handle<Code> CompileCallConstant(Handle<Object> object, |
835 Handle<JSObject> holder, | 858 Handle<JSObject> holder, |
836 Handle<JSFunction> function, | 859 Handle<JSFunction> function, |
837 Handle<String> name, | 860 Handle<String> name, |
838 CheckType check); | 861 CheckType check); |
839 | 862 |
840 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, | 863 MUST_USE_RESULT MaybeObject* CompileCallConstant(Object* object, |
841 JSObject* holder, | 864 JSObject* holder, |
842 JSFunction* function, | 865 JSFunction* function, |
843 String* name, | 866 String* name, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 JSFunction* function, | 915 JSFunction* function, |
893 String* name); | 916 String* name); |
894 | 917 |
895 const ParameterCount arguments_; | 918 const ParameterCount arguments_; |
896 const Code::Kind kind_; | 919 const Code::Kind kind_; |
897 const Code::ExtraICState extra_state_; | 920 const Code::ExtraICState extra_state_; |
898 const InlineCacheHolderFlag cache_holder_; | 921 const InlineCacheHolderFlag cache_holder_; |
899 | 922 |
900 const ParameterCount& arguments() { return arguments_; } | 923 const ParameterCount& arguments() { return arguments_; } |
901 | 924 |
902 MUST_USE_RESULT MaybeObject* GetCode(PropertyType type, String* name); | 925 Handle<Code> GetCode(PropertyType type, Handle<String> name); |
| 926 Handle<Code> GetCode(Handle<JSFunction> function); |
903 | 927 |
904 // Convenience function. Calls GetCode above passing | 928 // TODO(kmillikin): Eliminate these functions when the stub cache is fully |
905 // CONSTANT_FUNCTION type and the name of the given function. | 929 // handlified. |
906 MUST_USE_RESULT MaybeObject* GetCode(JSFunction* function); | 930 MUST_USE_RESULT MaybeObject* TryGetCode(PropertyType type, String* name); |
| 931 MUST_USE_RESULT MaybeObject* TryGetCode(JSFunction* function); |
907 | 932 |
908 void GenerateNameCheck(String* name, Label* miss); | 933 void GenerateNameCheck(Handle<String> name, Label* miss); |
909 | 934 |
910 void GenerateGlobalReceiverCheck(JSObject* object, | 935 void GenerateGlobalReceiverCheck(JSObject* object, |
911 JSObject* holder, | 936 JSObject* holder, |
912 String* name, | 937 String* name, |
913 Label* miss); | 938 Label* miss); |
914 | 939 |
915 // Generates code to load the function from the cell checking that | 940 // Generates code to load the function from the cell checking that |
916 // it still contains the same function. | 941 // it still contains the same function. |
917 void GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, | 942 void GenerateLoadFunctionFromCell(JSGlobalPropertyCell* cell, |
918 JSFunction* function, | 943 JSFunction* function, |
919 Label* miss); | 944 Label* miss); |
920 | 945 |
921 // Generates a jump to CallIC miss stub. Returns Failure if the jump cannot | 946 // Generates a jump to CallIC miss stub. |
922 // be generated. | 947 void GenerateMissBranch(); |
923 MUST_USE_RESULT MaybeObject* GenerateMissBranch(); | 948 |
| 949 // TODO(kmillikin): Eliminate this function when the stub cache is fully |
| 950 // handlified. |
| 951 MUST_USE_RESULT MaybeObject* TryGenerateMissBranch(); |
924 }; | 952 }; |
925 | 953 |
926 | 954 |
927 class ConstructStubCompiler: public StubCompiler { | 955 class ConstructStubCompiler: public StubCompiler { |
928 public: | 956 public: |
929 explicit ConstructStubCompiler(Isolate* isolate) : StubCompiler(isolate) { } | 957 explicit ConstructStubCompiler(Isolate* isolate) : StubCompiler(isolate) { } |
930 | 958 |
931 MUST_USE_RESULT MaybeObject* CompileConstructStub(JSFunction* function); | 959 MUST_USE_RESULT MaybeObject* CompileConstructStub(JSFunction* function); |
932 | 960 |
933 private: | 961 private: |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 JSFunction* constant_function_; | 1008 JSFunction* constant_function_; |
981 bool is_simple_api_call_; | 1009 bool is_simple_api_call_; |
982 FunctionTemplateInfo* expected_receiver_type_; | 1010 FunctionTemplateInfo* expected_receiver_type_; |
983 CallHandlerInfo* api_call_info_; | 1011 CallHandlerInfo* api_call_info_; |
984 }; | 1012 }; |
985 | 1013 |
986 | 1014 |
987 } } // namespace v8::internal | 1015 } } // namespace v8::internal |
988 | 1016 |
989 #endif // V8_STUB_CACHE_H_ | 1017 #endif // V8_STUB_CACHE_H_ |
OLD | NEW |