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::PatchImplicitReceiver(Handle<Object> object) { |
2472 Handle<JSFunction> function) { | |
2473 if (object->IsGlobalObject()) { | 2472 if (object->IsGlobalObject()) { |
2474 const int argc = arguments().immediate(); | 2473 const int argc = arguments().immediate(); |
2475 const int receiver_offset = (argc + 1) * kPointerSize; | 2474 const int receiver_offset = (argc + 1) * kPointerSize; |
2476 __ LoadHeapObject(edx, handle(function->context()->global_proxy())); | 2475 __ mov(Operand(esp, receiver_offset), |
2477 __ mov(Operand(esp, receiver_offset), edx); | 2476 isolate()->factory()->undefined_value()); |
2478 } | 2477 } |
2479 } | 2478 } |
2480 | 2479 |
2481 | |
2482 void CallStubCompiler::PatchGlobalProxy(Handle<Object> object, | |
2483 Register function) { | |
2484 if (object->IsGlobalObject()) { | |
2485 FetchGlobalProxy(masm(), edx, function); | |
2486 const int argc = arguments().immediate(); | |
2487 const int receiver_offset = (argc + 1) * kPointerSize; | |
2488 __ mov(Operand(esp, receiver_offset), edx); | |
2489 } | |
2490 } | |
2491 | |
2492 | 2480 |
2493 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, | 2481 Register CallStubCompiler::HandlerFrontendHeader(Handle<Object> object, |
2494 Handle<JSObject> holder, | 2482 Handle<JSObject> holder, |
2495 Handle<Name> name, | 2483 Handle<Name> name, |
2496 CheckType check, | 2484 CheckType check, |
2497 Label* miss) { | 2485 Label* miss) { |
2498 GenerateNameCheck(name, miss); | 2486 GenerateNameCheck(name, miss); |
2499 | 2487 |
2500 Register reg = edx; | 2488 Register reg = edx; |
2501 | 2489 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2571 } | 2559 } |
2572 | 2560 |
2573 | 2561 |
2574 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, | 2562 void CallStubCompiler::GenerateJumpFunction(Handle<Object> object, |
2575 Register function, | 2563 Register function, |
2576 Label* miss) { | 2564 Label* miss) { |
2577 // Check that the function really is a function. | 2565 // Check that the function really is a function. |
2578 GenerateFunctionCheck(function, ebx, miss); | 2566 GenerateFunctionCheck(function, ebx, miss); |
2579 | 2567 |
2580 if (!function.is(edi)) __ mov(edi, function); | 2568 if (!function.is(edi)) __ mov(edi, function); |
2581 PatchGlobalProxy(object, function); | 2569 PatchImplicitReceiver(object); |
2582 | 2570 |
2583 // Invoke the function. | 2571 // Invoke the function. |
2584 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION, | 2572 __ InvokeFunction(edi, arguments(), JUMP_FUNCTION, |
2585 NullCallWrapper(), call_kind()); | 2573 NullCallWrapper(), call_kind()); |
2586 } | 2574 } |
2587 | 2575 |
2588 | 2576 |
2589 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, | 2577 Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object, |
2590 Handle<JSObject> holder, | 2578 Handle<JSObject> holder, |
2591 Handle<Name> name) { | 2579 Handle<Name> name) { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 | 2674 |
2687 // Return the generated code. | 2675 // Return the generated code. |
2688 return GetCode(kind(), Code::FAST, name); | 2676 return GetCode(kind(), Code::FAST, name); |
2689 } | 2677 } |
2690 | 2678 |
2691 | 2679 |
2692 #undef __ | 2680 #undef __ |
2693 #define __ ACCESS_MASM(masm) | 2681 #define __ ACCESS_MASM(masm) |
2694 | 2682 |
2695 | 2683 |
2696 void CallStubCompiler::FetchGlobalProxy(MacroAssembler* masm, | |
2697 Register target, | |
2698 Register function) { | |
2699 __ mov(target, FieldOperand(function, JSFunction::kContextOffset)); | |
2700 __ mov(target, ContextOperand(target, Context::GLOBAL_OBJECT_INDEX)); | |
2701 __ mov(target, FieldOperand(target, GlobalObject::kGlobalReceiverOffset)); | |
2702 } | |
2703 | |
2704 | |
2705 void StoreStubCompiler::GenerateStoreViaSetter( | 2684 void StoreStubCompiler::GenerateStoreViaSetter( |
2706 MacroAssembler* masm, | 2685 MacroAssembler* masm, |
2707 Handle<JSFunction> setter) { | 2686 Handle<JSFunction> setter) { |
2708 // ----------- S t a t e ------------- | 2687 // ----------- S t a t e ------------- |
2709 // -- eax : value | 2688 // -- eax : value |
2710 // -- ecx : name | 2689 // -- ecx : name |
2711 // -- edx : receiver | 2690 // -- edx : receiver |
2712 // -- esp[0] : return address | 2691 // -- esp[0] : return address |
2713 // ----------------------------------- | 2692 // ----------------------------------- |
2714 { | 2693 { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3014 // ----------------------------------- | 2993 // ----------------------------------- |
3015 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2994 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
3016 } | 2995 } |
3017 | 2996 |
3018 | 2997 |
3019 #undef __ | 2998 #undef __ |
3020 | 2999 |
3021 } } // namespace v8::internal | 3000 } } // namespace v8::internal |
3022 | 3001 |
3023 #endif // V8_TARGET_ARCH_IA32 | 3002 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |