| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { | 394 void StubCompiler::GenerateLoadMiss(MacroAssembler* masm, Code::Kind kind) { |
| 395 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); | 395 ASSERT(kind == Code::LOAD_IC || kind == Code::KEYED_LOAD_IC); |
| 396 Code* code = NULL; | 396 Code* code = NULL; |
| 397 if (kind == Code::LOAD_IC) { | 397 if (kind == Code::LOAD_IC) { |
| 398 code = Builtins::builtin(Builtins::LoadIC_Miss); | 398 code = Builtins::builtin(Builtins::LoadIC_Miss); |
| 399 } else { | 399 } else { |
| 400 code = Builtins::builtin(Builtins::KeyedLoadIC_Miss); | 400 code = Builtins::builtin(Builtins::KeyedLoadIC_Miss); |
| 401 } | 401 } |
| 402 | 402 |
| 403 Handle<Code> ic(code); | 403 Handle<Code> ic(code); |
| 404 __ jmp(ic, code_target); | 404 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 405 } | 405 } |
| 406 | 406 |
| 407 | 407 |
| 408 void StubCompiler::GenerateStoreField(MacroAssembler* masm, | 408 void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
| 409 JSObject* object, | 409 JSObject* object, |
| 410 int index, | 410 int index, |
| 411 Map* transition, | 411 Map* transition, |
| 412 Register receiver_reg, | 412 Register receiver_reg, |
| 413 Register name_reg, | 413 Register name_reg, |
| 414 Register scratch, | 414 Register scratch, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 519 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |
| 520 __ cmp(ebx, JS_FUNCTION_TYPE); | 520 __ cmp(ebx, JS_FUNCTION_TYPE); |
| 521 __ j(not_equal, &miss, not_taken); | 521 __ j(not_equal, &miss, not_taken); |
| 522 | 522 |
| 523 // Invoke the function. | 523 // Invoke the function. |
| 524 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); | 524 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); |
| 525 | 525 |
| 526 // Handle call cache miss. | 526 // Handle call cache miss. |
| 527 __ bind(&miss); | 527 __ bind(&miss); |
| 528 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 528 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 529 __ jmp(ic, code_target); | 529 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 530 | 530 |
| 531 // Return the generated code. | 531 // Return the generated code. |
| 532 return GetCode(FIELD); | 532 return GetCode(FIELD); |
| 533 } | 533 } |
| 534 | 534 |
| 535 | 535 |
| 536 Object* CallStubCompiler::CompileCallConstant(Object* object, | 536 Object* CallStubCompiler::CompileCallConstant(Object* object, |
| 537 JSObject* holder, | 537 JSObject* holder, |
| 538 JSFunction* function, | 538 JSFunction* function, |
| 539 CheckType check) { | 539 CheckType check) { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 UNREACHABLE(); | 624 UNREACHABLE(); |
| 625 } | 625 } |
| 626 | 626 |
| 627 // Get the function and setup the context. | 627 // Get the function and setup the context. |
| 628 __ mov(Operand(edi), Immediate(Handle<JSFunction>(function))); | 628 __ mov(Operand(edi), Immediate(Handle<JSFunction>(function))); |
| 629 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); | 629 __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset)); |
| 630 | 630 |
| 631 // Jump to the cached code (tail call). | 631 // Jump to the cached code (tail call). |
| 632 Handle<Code> code(function->code()); | 632 Handle<Code> code(function->code()); |
| 633 ParameterCount expected(function->shared()->formal_parameter_count()); | 633 ParameterCount expected(function->shared()->formal_parameter_count()); |
| 634 __ InvokeCode(code, expected, arguments(), code_target, JUMP_FUNCTION); | 634 __ InvokeCode(code, expected, arguments(), |
| 635 RelocInfo::CODE_TARGET, JUMP_FUNCTION); |
| 635 | 636 |
| 636 // Handle call cache miss. | 637 // Handle call cache miss. |
| 637 __ bind(&miss); | 638 __ bind(&miss); |
| 638 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); | 639 Handle<Code> ic = ComputeCallMiss(arguments().immediate()); |
| 639 __ jmp(ic, code_target); | 640 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 640 | 641 |
| 641 // Return the generated code. | 642 // Return the generated code. |
| 642 return GetCode(CONSTANT_FUNCTION); | 643 return GetCode(CONSTANT_FUNCTION); |
| 643 } | 644 } |
| 644 | 645 |
| 645 | 646 |
| 646 Object* CallStubCompiler::CompileCallInterceptor(Object* object, | 647 Object* CallStubCompiler::CompileCallInterceptor(Object* object, |
| 647 JSObject* holder, | 648 JSObject* holder, |
| 648 String* name) { | 649 String* name) { |
| 649 // ----------- S t a t e ------------- | 650 // ----------- S t a t e ------------- |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); | 697 __ movzx_b(ebx, FieldOperand(ebx, Map::kInstanceTypeOffset)); |
| 697 __ cmp(ebx, JS_FUNCTION_TYPE); | 698 __ cmp(ebx, JS_FUNCTION_TYPE); |
| 698 __ j(not_equal, &miss, not_taken); | 699 __ j(not_equal, &miss, not_taken); |
| 699 | 700 |
| 700 // Invoke the function. | 701 // Invoke the function. |
| 701 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); | 702 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION); |
| 702 | 703 |
| 703 // Handle load cache miss. | 704 // Handle load cache miss. |
| 704 __ bind(&miss); | 705 __ bind(&miss); |
| 705 Handle<Code> ic = ComputeCallMiss(argc); | 706 Handle<Code> ic = ComputeCallMiss(argc); |
| 706 __ jmp(ic, code_target); | 707 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 707 | 708 |
| 708 // Return the generated code. | 709 // Return the generated code. |
| 709 return GetCode(INTERCEPTOR); | 710 return GetCode(INTERCEPTOR); |
| 710 } | 711 } |
| 711 | 712 |
| 712 | 713 |
| 713 Object* StoreStubCompiler::CompileStoreField(JSObject* object, | 714 Object* StoreStubCompiler::CompileStoreField(JSObject* object, |
| 714 int index, | 715 int index, |
| 715 Map* transition, | 716 Map* transition, |
| 716 String* name) { | 717 String* name) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 727 // Get the object from the stack. | 728 // Get the object from the stack. |
| 728 __ mov(ebx, Operand(esp, 1 * kPointerSize)); | 729 __ mov(ebx, Operand(esp, 1 * kPointerSize)); |
| 729 | 730 |
| 730 // Generate store field code. Trashes the name register. | 731 // Generate store field code. Trashes the name register. |
| 731 GenerateStoreField(masm(), object, index, transition, ebx, ecx, edx, &miss); | 732 GenerateStoreField(masm(), object, index, transition, ebx, ecx, edx, &miss); |
| 732 | 733 |
| 733 // Handle store cache miss. | 734 // Handle store cache miss. |
| 734 __ bind(&miss); | 735 __ bind(&miss); |
| 735 __ mov(Operand(ecx), Immediate(Handle<String>(name))); // restore name | 736 __ mov(Operand(ecx), Immediate(Handle<String>(name))); // restore name |
| 736 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 737 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
| 737 __ jmp(ic, code_target); | 738 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 738 | 739 |
| 739 // Return the generated code. | 740 // Return the generated code. |
| 740 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION); | 741 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION); |
| 741 } | 742 } |
| 742 | 743 |
| 743 | 744 |
| 744 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, | 745 Object* StoreStubCompiler::CompileStoreCallback(JSObject* object, |
| 745 AccessorInfo* callback, | 746 AccessorInfo* callback, |
| 746 String* name) { | 747 String* name) { |
| 747 // ----------- S t a t e ------------- | 748 // ----------- S t a t e ------------- |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 | 785 |
| 785 // Do tail-call to the runtime system. | 786 // Do tail-call to the runtime system. |
| 786 ExternalReference store_callback_property = | 787 ExternalReference store_callback_property = |
| 787 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); | 788 ExternalReference(IC_Utility(IC::kStoreCallbackProperty)); |
| 788 __ TailCallRuntime(store_callback_property, 4); | 789 __ TailCallRuntime(store_callback_property, 4); |
| 789 | 790 |
| 790 // Handle store cache miss. | 791 // Handle store cache miss. |
| 791 __ bind(&miss); | 792 __ bind(&miss); |
| 792 __ mov(Operand(ecx), Immediate(Handle<String>(name))); // restore name | 793 __ mov(Operand(ecx), Immediate(Handle<String>(name))); // restore name |
| 793 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 794 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
| 794 __ jmp(ic, code_target); | 795 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 795 | 796 |
| 796 // Return the generated code. | 797 // Return the generated code. |
| 797 return GetCode(CALLBACKS); | 798 return GetCode(CALLBACKS); |
| 798 } | 799 } |
| 799 | 800 |
| 800 | 801 |
| 801 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, | 802 Object* StoreStubCompiler::CompileStoreInterceptor(JSObject* receiver, |
| 802 String* name) { | 803 String* name) { |
| 803 // ----------- S t a t e ------------- | 804 // ----------- S t a t e ------------- |
| 804 // -- eax : value | 805 // -- eax : value |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 | 840 |
| 840 // Do tail-call to the runtime system. | 841 // Do tail-call to the runtime system. |
| 841 ExternalReference store_ic_property = | 842 ExternalReference store_ic_property = |
| 842 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); | 843 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty)); |
| 843 __ TailCallRuntime(store_ic_property, 3); | 844 __ TailCallRuntime(store_ic_property, 3); |
| 844 | 845 |
| 845 // Handle store cache miss. | 846 // Handle store cache miss. |
| 846 __ bind(&miss); | 847 __ bind(&miss); |
| 847 __ mov(Operand(ecx), Immediate(Handle<String>(name))); // restore name | 848 __ mov(Operand(ecx), Immediate(Handle<String>(name))); // restore name |
| 848 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); | 849 Handle<Code> ic(Builtins::builtin(Builtins::StoreIC_Miss)); |
| 849 __ jmp(ic, code_target); | 850 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 850 | 851 |
| 851 // Return the generated code. | 852 // Return the generated code. |
| 852 return GetCode(INTERCEPTOR); | 853 return GetCode(INTERCEPTOR); |
| 853 } | 854 } |
| 854 | 855 |
| 855 | 856 |
| 856 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, | 857 Object* KeyedStoreStubCompiler::CompileStoreField(JSObject* object, |
| 857 int index, | 858 int index, |
| 858 Map* transition, | 859 Map* transition, |
| 859 String* name) { | 860 String* name) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 877 // Get the object from the stack. | 878 // Get the object from the stack. |
| 878 __ mov(ebx, Operand(esp, 2 * kPointerSize)); | 879 __ mov(ebx, Operand(esp, 2 * kPointerSize)); |
| 879 | 880 |
| 880 // Generate store field code. Trashes the name register. | 881 // Generate store field code. Trashes the name register. |
| 881 GenerateStoreField(masm(), object, index, transition, ebx, ecx, edx, &miss); | 882 GenerateStoreField(masm(), object, index, transition, ebx, ecx, edx, &miss); |
| 882 | 883 |
| 883 // Handle store cache miss. | 884 // Handle store cache miss. |
| 884 __ bind(&miss); | 885 __ bind(&miss); |
| 885 __ DecrementCounter(&Counters::keyed_store_field, 1); | 886 __ DecrementCounter(&Counters::keyed_store_field, 1); |
| 886 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); | 887 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Miss)); |
| 887 __ jmp(ic, code_target); | 888 __ jmp(ic, RelocInfo::CODE_TARGET); |
| 888 | 889 |
| 889 // Return the generated code. | 890 // Return the generated code. |
| 890 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION); | 891 return GetCode(transition == NULL ? FIELD : MAP_TRANSITION); |
| 891 } | 892 } |
| 892 | 893 |
| 893 | 894 |
| 894 Object* LoadStubCompiler::CompileLoadField(JSObject* object, | 895 Object* LoadStubCompiler::CompileLoadField(JSObject* object, |
| 895 JSObject* holder, | 896 JSObject* holder, |
| 896 int index) { | 897 int index) { |
| 897 // ----------- S t a t e ------------- | 898 // ----------- S t a t e ------------- |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); | 1233 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |
| 1233 | 1234 |
| 1234 // Return the generated code. | 1235 // Return the generated code. |
| 1235 return GetCode(CALLBACKS); | 1236 return GetCode(CALLBACKS); |
| 1236 } | 1237 } |
| 1237 | 1238 |
| 1238 | 1239 |
| 1239 #undef __ | 1240 #undef __ |
| 1240 | 1241 |
| 1241 } } // namespace v8::internal | 1242 } } // namespace v8::internal |
| OLD | NEW |