| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 __ bind(&miss); | 276 __ bind(&miss); |
| 277 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, | 277 __ IncrementCounter(counters->megamorphic_stub_cache_misses(), 1, |
| 278 extra2, extra3); | 278 extra2, extra3); |
| 279 } | 279 } |
| 280 | 280 |
| 281 | 281 |
| 282 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, | 282 void StubCompiler::GenerateLoadGlobalFunctionPrototype(MacroAssembler* masm, |
| 283 int index, | 283 int index, |
| 284 Register prototype) { | 284 Register prototype) { |
| 285 // Load the global or builtins object from the current context. | 285 // Load the global or builtins object from the current context. |
| 286 __ ldr(prototype, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 287 // Load the global context from the global or builtins object. |
| 286 __ ldr(prototype, | 288 __ ldr(prototype, |
| 287 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 289 FieldMemOperand(prototype, GlobalObject::kGlobalContextOffset)); |
| 288 // Load the native context from the global or builtins object. | 290 // Load the function from the global context. |
| 289 __ ldr(prototype, | |
| 290 FieldMemOperand(prototype, GlobalObject::kNativeContextOffset)); | |
| 291 // Load the function from the native context. | |
| 292 __ ldr(prototype, MemOperand(prototype, Context::SlotOffset(index))); | 291 __ ldr(prototype, MemOperand(prototype, Context::SlotOffset(index))); |
| 293 // Load the initial map. The global functions all have initial maps. | 292 // Load the initial map. The global functions all have initial maps. |
| 294 __ ldr(prototype, | 293 __ ldr(prototype, |
| 295 FieldMemOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset)); | 294 FieldMemOperand(prototype, JSFunction::kPrototypeOrInitialMapOffset)); |
| 296 // Load the prototype from the initial map. | 295 // Load the prototype from the initial map. |
| 297 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); | 296 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); |
| 298 } | 297 } |
| 299 | 298 |
| 300 | 299 |
| 301 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype( | 300 void StubCompiler::GenerateDirectLoadGlobalFunctionPrototype( |
| 302 MacroAssembler* masm, | 301 MacroAssembler* masm, |
| 303 int index, | 302 int index, |
| 304 Register prototype, | 303 Register prototype, |
| 305 Label* miss) { | 304 Label* miss) { |
| 306 Isolate* isolate = masm->isolate(); | 305 Isolate* isolate = masm->isolate(); |
| 307 // Check we're still in the same context. | 306 // Check we're still in the same context. |
| 308 __ ldr(prototype, | 307 __ ldr(prototype, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
| 309 MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 308 __ Move(ip, isolate->global()); |
| 310 __ Move(ip, isolate->global_object()); | |
| 311 __ cmp(prototype, ip); | 309 __ cmp(prototype, ip); |
| 312 __ b(ne, miss); | 310 __ b(ne, miss); |
| 313 // Get the global function with the given index. | 311 // Get the global function with the given index. |
| 314 Handle<JSFunction> function( | 312 Handle<JSFunction> function( |
| 315 JSFunction::cast(isolate->native_context()->get(index))); | 313 JSFunction::cast(isolate->global_context()->get(index))); |
| 316 // Load its initial map. The global functions all have initial maps. | 314 // Load its initial map. The global functions all have initial maps. |
| 317 __ Move(prototype, Handle<Map>(function->initial_map())); | 315 __ Move(prototype, Handle<Map>(function->initial_map())); |
| 318 // Load the prototype from the initial map. | 316 // Load the prototype from the initial map. |
| 319 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); | 317 __ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset)); |
| 320 } | 318 } |
| 321 | 319 |
| 322 | 320 |
| 323 // Load a fast property out of a holder object (src). In-object properties | 321 // Load a fast property out of a holder object (src). In-object properties |
| 324 // are loaded directly otherwise the property is loaded from the properties | 322 // are loaded directly otherwise the property is loaded from the properties |
| 325 // fixed array. | 323 // fixed array. |
| (...skipping 2384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2710 // Handle store cache miss. | 2708 // Handle store cache miss. |
| 2711 __ bind(&miss); | 2709 __ bind(&miss); |
| 2712 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); | 2710 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); |
| 2713 __ Jump(ic, RelocInfo::CODE_TARGET); | 2711 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 2714 | 2712 |
| 2715 // Return the generated code. | 2713 // Return the generated code. |
| 2716 return GetCode(Code::CALLBACKS, name); | 2714 return GetCode(Code::CALLBACKS, name); |
| 2717 } | 2715 } |
| 2718 | 2716 |
| 2719 | 2717 |
| 2720 #undef __ | 2718 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( |
| 2721 #define __ ACCESS_MASM(masm) | 2719 Handle<String> name, |
| 2722 | 2720 Handle<JSObject> receiver, |
| 2723 | 2721 Handle<JSObject> holder, |
| 2724 void StoreStubCompiler::GenerateStoreViaSetter( | |
| 2725 MacroAssembler* masm, | |
| 2726 Handle<JSFunction> setter) { | 2722 Handle<JSFunction> setter) { |
| 2727 // ----------- S t a t e ------------- | 2723 // ----------- S t a t e ------------- |
| 2728 // -- r0 : value | 2724 // -- r0 : value |
| 2729 // -- r1 : receiver | 2725 // -- r1 : receiver |
| 2730 // -- r2 : name | 2726 // -- r2 : name |
| 2731 // -- lr : return address | 2727 // -- lr : return address |
| 2732 // ----------------------------------- | 2728 // ----------------------------------- |
| 2729 Label miss; |
| 2730 |
| 2731 // Check that the maps haven't changed. |
| 2732 __ JumpIfSmi(r1, &miss); |
| 2733 CheckPrototypes(receiver, r1, holder, r3, r4, r5, name, &miss); |
| 2734 |
| 2733 { | 2735 { |
| 2734 FrameScope scope(masm, StackFrame::INTERNAL); | 2736 FrameScope scope(masm(), StackFrame::INTERNAL); |
| 2735 | 2737 |
| 2736 // Save value register, so we can restore it later. | 2738 // Save value register, so we can restore it later. |
| 2737 __ push(r0); | 2739 __ push(r0); |
| 2738 | 2740 |
| 2739 if (!setter.is_null()) { | 2741 // Call the JavaScript setter with the receiver and the value on the stack. |
| 2740 // Call the JavaScript setter with receiver and value on the stack. | 2742 __ Push(r1, r0); |
| 2741 __ Push(r1, r0); | 2743 ParameterCount actual(1); |
| 2742 ParameterCount actual(1); | 2744 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), |
| 2743 __ InvokeFunction(setter, actual, CALL_FUNCTION, NullCallWrapper(), | 2745 CALL_AS_METHOD); |
| 2744 CALL_AS_METHOD); | |
| 2745 } else { | |
| 2746 // If we generate a global code snippet for deoptimization only, remember | |
| 2747 // the place to continue after deoptimization. | |
| 2748 masm->isolate()->heap()->SetSetterStubDeoptPCOffset(masm->pc_offset()); | |
| 2749 } | |
| 2750 | 2746 |
| 2751 // We have to return the passed value, not the return value of the setter. | 2747 // We have to return the passed value, not the return value of the setter. |
| 2752 __ pop(r0); | 2748 __ pop(r0); |
| 2753 | 2749 |
| 2754 // Restore context register. | 2750 // Restore context register. |
| 2755 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2751 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 2756 } | 2752 } |
| 2757 __ Ret(); | 2753 __ Ret(); |
| 2758 } | |
| 2759 | |
| 2760 | |
| 2761 #undef __ | |
| 2762 #define __ ACCESS_MASM(masm()) | |
| 2763 | |
| 2764 | |
| 2765 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( | |
| 2766 Handle<String> name, | |
| 2767 Handle<JSObject> receiver, | |
| 2768 Handle<JSObject> holder, | |
| 2769 Handle<JSFunction> setter) { | |
| 2770 // ----------- S t a t e ------------- | |
| 2771 // -- r0 : value | |
| 2772 // -- r1 : receiver | |
| 2773 // -- r2 : name | |
| 2774 // -- lr : return address | |
| 2775 // ----------------------------------- | |
| 2776 Label miss; | |
| 2777 | |
| 2778 // Check that the maps haven't changed. | |
| 2779 __ JumpIfSmi(r1, &miss); | |
| 2780 CheckPrototypes(receiver, r1, holder, r3, r4, r5, name, &miss); | |
| 2781 | |
| 2782 GenerateStoreViaSetter(masm(), setter); | |
| 2783 | 2754 |
| 2784 __ bind(&miss); | 2755 __ bind(&miss); |
| 2785 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); | 2756 Handle<Code> ic = masm()->isolate()->builtins()->StoreIC_Miss(); |
| 2786 __ Jump(ic, RelocInfo::CODE_TARGET); | 2757 __ Jump(ic, RelocInfo::CODE_TARGET); |
| 2787 | 2758 |
| 2788 // Return the generated code. | 2759 // Return the generated code. |
| 2789 return GetCode(Code::CALLBACKS, name); | 2760 return GetCode(Code::CALLBACKS, name); |
| 2790 } | 2761 } |
| 2791 | 2762 |
| 2792 | 2763 |
| (...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4754 __ Jump(ic_slow, RelocInfo::CODE_TARGET); | 4725 __ Jump(ic_slow, RelocInfo::CODE_TARGET); |
| 4755 } | 4726 } |
| 4756 } | 4727 } |
| 4757 | 4728 |
| 4758 | 4729 |
| 4759 #undef __ | 4730 #undef __ |
| 4760 | 4731 |
| 4761 } } // namespace v8::internal | 4732 } } // namespace v8::internal |
| 4762 | 4733 |
| 4763 #endif // V8_TARGET_ARCH_ARM | 4734 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |