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 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2330 Label success; | 2330 Label success; |
2331 // Check that the object is a boolean. | 2331 // Check that the object is a boolean. |
2332 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 2332 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
2333 __ Branch(&success, eq, object, Operand(at)); | 2333 __ Branch(&success, eq, object, Operand(at)); |
2334 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 2334 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
2335 __ Branch(miss, ne, object, Operand(at)); | 2335 __ Branch(miss, ne, object, Operand(at)); |
2336 __ bind(&success); | 2336 __ bind(&success); |
2337 } | 2337 } |
2338 | 2338 |
2339 | 2339 |
2340 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, | 2340 void CallStubCompiler::PatchImplicitReceiver(Handle<Object> object) { |
2341 Handle<JSFunction> function) { | |
2342 if (object->IsGlobalObject()) { | 2341 if (object->IsGlobalObject()) { |
2343 const int argc = arguments().immediate(); | 2342 const int argc = arguments().immediate(); |
2344 const int receiver_offset = argc * kPointerSize; | 2343 const int receiver_offset = argc * kPointerSize; |
2345 __ li(a3, handle(function->context()->global_proxy())); | 2344 __ LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
2346 __ sw(a3, MemOperand(sp, receiver_offset)); | 2345 __ sw(a3, MemOperand(sp, receiver_offset)); |
2347 } | 2346 } |
2348 } | 2347 } |
2349 | |
2350 | |
2351 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, | |
2352 Register function) { | |
2353 if (object->IsGlobalObject()) { | |
2354 FetchGlobalProxy(masm(), a3, function); | |
2355 const int argc = arguments().immediate(); | |
2356 const int receiver_offset = argc * kPointerSize; | |
2357 __ sw(a3, MemOperand(sp, receiver_offset)); | |
2358 } | |
2359 } | |
2360 | 2348 |
2361 | 2349 |
2362 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, | 2350 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
2363 Handle<JSObject> holder, | 2351 Handle<JSObject> holder, |
2364 Handle<Name> name, | 2352 Handle<Name> name, |
2365 CheckType check, | 2353 CheckType check, |
2366 Label* miss) { | 2354 Label* miss) { |
2367 // ----------- S t a t e ------------- | 2355 // ----------- S t a t e ------------- |
2368 // -- a2 : name | 2356 // -- a2 : name |
2369 // -- ra : return address | 2357 // -- ra : return address |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2445 return reg; | 2433 return reg; |
2446 } | 2434 } |
2447 | 2435 |
2448 | 2436 |
2449 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | 2437 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, |
2450 Register function, | 2438 Register function, |
2451 Label* miss) { | 2439 Label* miss) { |
2452 ASSERT(function.is(a1)); | 2440 ASSERT(function.is(a1)); |
2453 // Check that the function really is a function. | 2441 // Check that the function really is a function. |
2454 GenerateFunctionCheck(function, a3, miss); | 2442 GenerateFunctionCheck(function, a3, miss); |
2455 PatchGlobalProxy(object, function); | 2443 PatchImplicitReceiver(object); |
| 2444 |
2456 // Invoke the function. | 2445 // Invoke the function. |
2457 __ InvokeFunction(a1, arguments(), JUMP_FUNCTION, | 2446 __ InvokeFunction(a1, arguments(), JUMP_FUNCTION, |
2458 NullCallWrapper(), call_kind()); | 2447 NullCallWrapper(), call_kind()); |
2459 } | 2448 } |
2460 | 2449 |
2461 | 2450 |
2462 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, | 2451 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
2463 Handle<JSObject> holder, | 2452 Handle<JSObject> holder, |
2464 Handle<Name> name) { | 2453 Handle<Name> name) { |
2465 Label miss; | 2454 Label miss; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2563 | 2552 |
2564 // Return the generated code. | 2553 // Return the generated code. |
2565 return GetCode(kind(), Code::FAST, name); | 2554 return GetCode(kind(), Code::FAST, name); |
2566 } | 2555 } |
2567 | 2556 |
2568 | 2557 |
2569 #undef __ | 2558 #undef __ |
2570 #define __ ACCESS_MASM(masm) | 2559 #define __ ACCESS_MASM(masm) |
2571 | 2560 |
2572 | 2561 |
2573 void CallStubCompiler::FetchGlobalProxy(MacroAssembler* masm, | |
2574 Register target, | |
2575 Register function) { | |
2576 __ lw(target, FieldMemOperand(function, JSFunction::kContextOffset)); | |
2577 __ lw(target, ContextOperand(target, Context::GLOBAL_OBJECT_INDEX)); | |
2578 __ lw(target, FieldMemOperand(target, GlobalObject::kGlobalReceiverOffset)); | |
2579 } | |
2580 | |
2581 | |
2582 void StoreStubCompiler::GenerateStoreViaSetter( | 2562 void StoreStubCompiler::GenerateStoreViaSetter( |
2583 MacroAssembler* masm, | 2563 MacroAssembler* masm, |
2584 Handle<JSFunction> setter) { | 2564 Handle<JSFunction> setter) { |
2585 // ----------- S t a t e ------------- | 2565 // ----------- S t a t e ------------- |
2586 // -- a0 : value | 2566 // -- a0 : value |
2587 // -- a1 : receiver | 2567 // -- a1 : receiver |
2588 // -- a2 : name | 2568 // -- a2 : name |
2589 // -- ra : return address | 2569 // -- ra : return address |
2590 // ----------------------------------- | 2570 // ----------------------------------- |
2591 { | 2571 { |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2905 // ----------------------------------- | 2885 // ----------------------------------- |
2906 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2886 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2907 } | 2887 } |
2908 | 2888 |
2909 | 2889 |
2910 #undef __ | 2890 #undef __ |
2911 | 2891 |
2912 } } // namespace v8::internal | 2892 } } // namespace v8::internal |
2913 | 2893 |
2914 #endif // V8_TARGET_ARCH_MIPS | 2894 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |