| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #endif | 100 #endif |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 | 103 |
| 104 // Generate code for a JS function. On entry to the function the receiver | 104 // Generate code for a JS function. On entry to the function the receiver |
| 105 // and arguments have been pushed on the stack left to right, with the | 105 // and arguments have been pushed on the stack left to right, with the |
| 106 // return address on top of them. The actual argument count matches the | 106 // return address on top of them. The actual argument count matches the |
| 107 // formal parameter count expected by the function. | 107 // formal parameter count expected by the function. |
| 108 // | 108 // |
| 109 // The live registers are: | 109 // The live registers are: |
| 110 // o ecx: CallKind | |
| 111 // o edi: the JS function object being called (i.e. ourselves) | 110 // o edi: the JS function object being called (i.e. ourselves) |
| 112 // o esi: our context | 111 // o esi: our context |
| 113 // o ebp: our caller's frame pointer | 112 // o ebp: our caller's frame pointer |
| 114 // o esp: stack pointer (pointing to return address) | 113 // o esp: stack pointer (pointing to return address) |
| 115 // | 114 // |
| 116 // The function builds a JS frame. Please see JavaScriptFrameConstants in | 115 // The function builds a JS frame. Please see JavaScriptFrameConstants in |
| 117 // frames-ia32.h for its layout. | 116 // frames-ia32.h for its layout. |
| 118 void FullCodeGenerator::Generate() { | 117 void FullCodeGenerator::Generate() { |
| 119 CompilationInfo* info = info_; | 118 CompilationInfo* info = info_; |
| 120 handler_table_ = | 119 handler_table_ = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 131 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 130 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| 132 __ int3(); | 131 __ int3(); |
| 133 } | 132 } |
| 134 #endif | 133 #endif |
| 135 | 134 |
| 136 // Classic mode functions and builtins need to replace the receiver with the | 135 // Classic mode functions and builtins need to replace the receiver with the |
| 137 // global proxy when called as functions (without an explicit receiver | 136 // global proxy when called as functions (without an explicit receiver |
| 138 // object). | 137 // object). |
| 139 if (info->is_classic_mode() && !info->is_native()) { | 138 if (info->is_classic_mode() && !info->is_native()) { |
| 140 Label ok; | 139 Label ok; |
| 141 __ test(ecx, ecx); | |
| 142 __ j(zero, &ok, Label::kNear); | |
| 143 | |
| 144 // +1 for return address. | 140 // +1 for return address. |
| 145 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; | 141 int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize; |
| 146 __ mov(ecx, Operand(esp, receiver_offset)); | 142 __ mov(ecx, Operand(esp, receiver_offset)); |
| 147 | 143 |
| 148 __ cmp(ecx, isolate()->factory()->undefined_value()); | 144 __ cmp(ecx, isolate()->factory()->undefined_value()); |
| 149 __ j(not_equal, &ok, Label::kNear); | 145 __ j(not_equal, &ok, Label::kNear); |
| 150 | 146 |
| 151 __ mov(ecx, GlobalObjectOperand()); | 147 __ mov(ecx, GlobalObjectOperand()); |
| 152 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); | 148 __ mov(ecx, FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset)); |
| 153 | 149 |
| (...skipping 3533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3687 | 3683 |
| 3688 Label runtime, done; | 3684 Label runtime, done; |
| 3689 // Check for non-function argument (including proxy). | 3685 // Check for non-function argument (including proxy). |
| 3690 __ JumpIfSmi(eax, &runtime); | 3686 __ JumpIfSmi(eax, &runtime); |
| 3691 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); | 3687 __ CmpObjectType(eax, JS_FUNCTION_TYPE, ebx); |
| 3692 __ j(not_equal, &runtime); | 3688 __ j(not_equal, &runtime); |
| 3693 | 3689 |
| 3694 // InvokeFunction requires the function in edi. Move it in there. | 3690 // InvokeFunction requires the function in edi. Move it in there. |
| 3695 __ mov(edi, result_register()); | 3691 __ mov(edi, result_register()); |
| 3696 ParameterCount count(arg_count); | 3692 ParameterCount count(arg_count); |
| 3697 __ InvokeFunction(edi, count, CALL_FUNCTION, | 3693 __ InvokeFunction(edi, count, CALL_FUNCTION, NullCallWrapper()); |
| 3698 NullCallWrapper(), CALL_AS_FUNCTION); | |
| 3699 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 3694 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 3700 __ jmp(&done); | 3695 __ jmp(&done); |
| 3701 | 3696 |
| 3702 __ bind(&runtime); | 3697 __ bind(&runtime); |
| 3703 __ push(eax); | 3698 __ push(eax); |
| 3704 __ CallRuntime(Runtime::kCall, args->length()); | 3699 __ CallRuntime(Runtime::kCall, args->length()); |
| 3705 __ bind(&done); | 3700 __ bind(&done); |
| 3706 | 3701 |
| 3707 context()->Plug(eax); | 3702 context()->Plug(eax); |
| 3708 } | 3703 } |
| (...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4891 | 4886 |
| 4892 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4887 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4893 Assembler::target_address_at(call_target_address)); | 4888 Assembler::target_address_at(call_target_address)); |
| 4894 return OSR_AFTER_STACK_CHECK; | 4889 return OSR_AFTER_STACK_CHECK; |
| 4895 } | 4890 } |
| 4896 | 4891 |
| 4897 | 4892 |
| 4898 } } // namespace v8::internal | 4893 } } // namespace v8::internal |
| 4899 | 4894 |
| 4900 #endif // V8_TARGET_ARCH_IA32 | 4895 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |