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 2323 matching lines...) Loading... |
2334 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 2334 __ LoadRoot(ip, Heap::kTrueValueRootIndex); |
2335 __ cmp(object, ip); | 2335 __ cmp(object, ip); |
2336 __ b(eq, &success); | 2336 __ b(eq, &success); |
2337 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | 2337 __ LoadRoot(ip, Heap::kFalseValueRootIndex); |
2338 __ cmp(object, ip); | 2338 __ cmp(object, ip); |
2339 __ b(ne, miss); | 2339 __ b(ne, miss); |
2340 __ bind(&success); | 2340 __ bind(&success); |
2341 } | 2341 } |
2342 | 2342 |
2343 | 2343 |
2344 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { | 2344 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, |
| 2345 Handle<JSFunction> function) { |
2345 if (object->IsGlobalObject()) { | 2346 if (object->IsGlobalObject()) { |
2346 const int argc = arguments().immediate(); | 2347 const int argc = arguments().immediate(); |
2347 const int receiver_offset = argc * kPointerSize; | 2348 const int receiver_offset = argc * kPointerSize; |
2348 __ ldr(r3, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); | 2349 __ Move(r3, handle(function->context()->global_proxy())); |
2349 __ str(r3, MemOperand(sp, receiver_offset)); | 2350 __ str(r3, MemOperand(sp, receiver_offset)); |
2350 } | 2351 } |
2351 } | 2352 } |
| 2353 |
| 2354 |
| 2355 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, |
| 2356 Register function) { |
| 2357 if (object->IsGlobalObject()) { |
| 2358 FetchGlobalProxy(masm(), r3, function); |
| 2359 const int argc = arguments().immediate(); |
| 2360 const int receiver_offset = argc * kPointerSize; |
| 2361 __ str(r3, MemOperand(sp, receiver_offset)); |
| 2362 } |
| 2363 } |
2352 | 2364 |
2353 | 2365 |
2354 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, | 2366 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
2355 Handle<JSObject> holder, | 2367 Handle<JSObject> holder, |
2356 Handle<Name> name, | 2368 Handle<Name> name, |
2357 CheckType check, | 2369 CheckType check, |
2358 Label* miss) { | 2370 Label* miss) { |
2359 // ----------- S t a t e ------------- | 2371 // ----------- S t a t e ------------- |
2360 // -- r2 : name | 2372 // -- r2 : name |
2361 // -- lr : return address | 2373 // -- lr : return address |
(...skipping 75 matching lines...) Loading... |
2437 return reg; | 2449 return reg; |
2438 } | 2450 } |
2439 | 2451 |
2440 | 2452 |
2441 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | 2453 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, |
2442 Register function, | 2454 Register function, |
2443 Label* miss) { | 2455 Label* miss) { |
2444 ASSERT(function.is(r1)); | 2456 ASSERT(function.is(r1)); |
2445 // Check that the function really is a function. | 2457 // Check that the function really is a function. |
2446 GenerateFunctionCheck(function, r3, miss); | 2458 GenerateFunctionCheck(function, r3, miss); |
2447 PatchGlobalProxy(object); | 2459 PatchGlobalProxy(object, function); |
2448 | 2460 |
2449 // Invoke the function. | 2461 // Invoke the function. |
2450 __ InvokeFunction(r1, arguments(), JUMP_FUNCTION, | 2462 __ InvokeFunction(r1, arguments(), JUMP_FUNCTION, |
2451 NullCallWrapper(), call_kind()); | 2463 NullCallWrapper(), call_kind()); |
2452 } | 2464 } |
2453 | 2465 |
2454 | 2466 |
2455 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, | 2467 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
2456 Handle<JSObject> holder, | 2468 Handle<JSObject> holder, |
2457 Handle<Name> name) { | 2469 Handle<Name> name) { |
(...skipping 97 matching lines...) Loading... |
2555 | 2567 |
2556 // Return the generated code. | 2568 // Return the generated code. |
2557 return GetCode(kind(), Code::FAST, name); | 2569 return GetCode(kind(), Code::FAST, name); |
2558 } | 2570 } |
2559 | 2571 |
2560 | 2572 |
2561 #undef __ | 2573 #undef __ |
2562 #define __ ACCESS_MASM(masm) | 2574 #define __ ACCESS_MASM(masm) |
2563 | 2575 |
2564 | 2576 |
| 2577 void CallStubCompiler::FetchGlobalProxy(MacroAssembler* masm, |
| 2578 Register target, |
| 2579 Register function) { |
| 2580 __ ldr(target, FieldMemOperand(function, JSFunction::kContextOffset)); |
| 2581 __ ldr(target, ContextOperand(target, Context::GLOBAL_OBJECT_INDEX)); |
| 2582 __ ldr(target, FieldMemOperand(target, GlobalObject::kGlobalReceiverOffset)); |
| 2583 } |
| 2584 |
| 2585 |
2565 void StoreStubCompiler::GenerateStoreViaSetter( | 2586 void StoreStubCompiler::GenerateStoreViaSetter( |
2566 MacroAssembler* masm, | 2587 MacroAssembler* masm, |
2567 Handle<JSFunction> setter) { | 2588 Handle<JSFunction> setter) { |
2568 // ----------- S t a t e ------------- | 2589 // ----------- S t a t e ------------- |
2569 // -- r0 : value | 2590 // -- r0 : value |
2570 // -- r1 : receiver | 2591 // -- r1 : receiver |
2571 // -- r2 : name | 2592 // -- r2 : name |
2572 // -- lr : return address | 2593 // -- lr : return address |
2573 // ----------------------------------- | 2594 // ----------------------------------- |
2574 { | 2595 { |
(...skipping 316 matching lines...) Loading... |
2891 // ----------------------------------- | 2912 // ----------------------------------- |
2892 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2913 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2893 } | 2914 } |
2894 | 2915 |
2895 | 2916 |
2896 #undef __ | 2917 #undef __ |
2897 | 2918 |
2898 } } // namespace v8::internal | 2919 } } // namespace v8::internal |
2899 | 2920 |
2900 #endif // V8_TARGET_ARCH_ARM | 2921 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |