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