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 2450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2461 Label success; | 2461 Label success; |
2462 // Check that the object is a boolean. | 2462 // Check that the object is a boolean. |
2463 __ cmp(object, factory()->true_value()); | 2463 __ cmp(object, factory()->true_value()); |
2464 __ j(equal, &success); | 2464 __ j(equal, &success); |
2465 __ cmp(object, factory()->false_value()); | 2465 __ cmp(object, factory()->false_value()); |
2466 __ j(not_equal, miss); | 2466 __ j(not_equal, miss); |
2467 __ bind(&success); | 2467 __ bind(&success); |
2468 } | 2468 } |
2469 | 2469 |
2470 | 2470 |
2471 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object) { | 2471 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, |
| 2472 Handle<JSFunction> function) { |
2472 if (object->IsGlobalObject()) { | 2473 if (object->IsGlobalObject()) { |
2473 const int argc = arguments().immediate(); | 2474 const int argc = arguments().immediate(); |
2474 const int receiver_offset = (argc + 1) * kPointerSize; | 2475 const int receiver_offset = (argc + 1) * kPointerSize; |
2475 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); | 2476 __ LoadHeapObject(edx, handle(function->context()->global_proxy())); |
2476 __ mov(Operand(esp, receiver_offset), edx); | 2477 __ mov(Operand(esp, receiver_offset), edx); |
2477 } | 2478 } |
2478 } | 2479 } |
2479 | 2480 |
2480 | 2481 |
2481 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, | 2482 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
2482 Handle<JSObject> holder, | 2483 Handle<JSObject> holder, |
2483 Handle<Name> name, | 2484 Handle<Name> name, |
2484 CheckType check, | 2485 CheckType check, |
2485 Label* miss) { | 2486 Label* miss) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2559 } | 2560 } |
2560 | 2561 |
2561 | 2562 |
2562 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | 2563 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, |
2563 Register function, | 2564 Register function, |
2564 Label* miss) { | 2565 Label* miss) { |
2565 // Check that the function really is a function. | 2566 // Check that the function really is a function. |
2566 GenerateFunctionCheck(function, ebx, miss); | 2567 GenerateFunctionCheck(function, ebx, miss); |
2567 | 2568 |
2568 if (!function.is(edi)) __ mov(edi, function); | 2569 if (!function.is(edi)) __ mov(edi, function); |
2569 PatchGlobalProxy(object); | 2570 PatchGlobalProxy(object, function); |
2570 | 2571 |
2571 // Invoke the function. | 2572 // Invoke the function. |
2572 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION, | 2573 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION, |
2573 NullCallWrapper(), call_kind()); | 2574 NullCallWrapper(), call_kind()); |
2574 } | 2575 } |
2575 | 2576 |
2576 | 2577 |
2577 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, | 2578 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
2578 Handle<JSObject> holder, | 2579 Handle<JSObject> holder, |
2579 Handle<Name> name) { | 2580 Handle<Name> name) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 | 2675 |
2675 // Return the generated code. | 2676 // Return the generated code. |
2676 return GetCode(kind(), Code::FAST, name); | 2677 return GetCode(kind(), Code::FAST, name); |
2677 } | 2678 } |
2678 | 2679 |
2679 | 2680 |
2680 #undef __ | 2681 #undef __ |
2681 #define __ ACCESS_MASM(masm) | 2682 #define __ ACCESS_MASM(masm) |
2682 | 2683 |
2683 | 2684 |
| 2685 void CallStubCompiler::PatchGlobalProxy(MacroAssembler* masm, |
| 2686 int argc, |
| 2687 Register function) { |
| 2688 __ mov(edx, FieldOperand(function, JSFunction::kContextOffset)); |
| 2689 __ mov(edx, ContextOperand(edx, Context::GLOBAL_OBJECT_INDEX)); |
| 2690 __ mov(edx, FieldOperand(edx, GlobalObject::kGlobalReceiverOffset)); |
| 2691 const int receiver_offset = (argc + 1) * kPointerSize; |
| 2692 __ mov(Operand(esp, receiver_offset), edx); |
| 2693 } |
| 2694 |
| 2695 |
2684 void StoreStubCompiler::GenerateStoreViaSetter( | 2696 void StoreStubCompiler::GenerateStoreViaSetter( |
2685 MacroAssembler* masm, | 2697 MacroAssembler* masm, |
2686 Handle<JSFunction> setter) { | 2698 Handle<JSFunction> setter) { |
2687 // ----------- S t a t e ------------- | 2699 // ----------- S t a t e ------------- |
2688 // -- eax : value | 2700 // -- eax : value |
2689 // -- ecx : name | 2701 // -- ecx : name |
2690 // -- edx : receiver | 2702 // -- edx : receiver |
2691 // -- esp[0] : return address | 2703 // -- esp[0] : return address |
2692 // ----------------------------------- | 2704 // ----------------------------------- |
2693 { | 2705 { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2993 // ----------------------------------- | 3005 // ----------------------------------- |
2994 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 3006 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2995 } | 3007 } |
2996 | 3008 |
2997 | 3009 |
2998 #undef __ | 3010 #undef __ |
2999 | 3011 |
3000 } } // namespace v8::internal | 3012 } } // namespace v8::internal |
3001 | 3013 |
3002 #endif // V8_TARGET_ARCH_IA32 | 3014 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |