OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 if (strlen(FLAG_stop_at) > 0 && | 137 if (strlen(FLAG_stop_at) > 0 && |
138 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { | 138 info_->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
139 __ int3(); | 139 __ int3(); |
140 } | 140 } |
141 #endif | 141 #endif |
142 | 142 |
143 // Strict mode functions and builtins need to replace the receiver | 143 // Strict mode functions and builtins need to replace the receiver |
144 // with undefined when called as functions (without an explicit | 144 // with undefined when called as functions (without an explicit |
145 // receiver object). ecx is zero for method calls and non-zero for | 145 // receiver object). ecx is zero for method calls and non-zero for |
146 // function calls. | 146 // function calls. |
147 if (info_->is_strict_mode() || info_->is_native()) { | 147 if (!info_->is_classic_mode() || info_->is_native()) { |
148 Label ok; | 148 Label ok; |
149 __ test(ecx, Operand(ecx)); | 149 __ test(ecx, Operand(ecx)); |
150 __ j(zero, &ok, Label::kNear); | 150 __ j(zero, &ok, Label::kNear); |
151 // +1 for return address. | 151 // +1 for return address. |
152 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; | 152 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; |
153 __ mov(Operand(esp, receiver_offset), | 153 __ mov(Operand(esp, receiver_offset), |
154 Immediate(isolate()->factory()->undefined_value())); | 154 Immediate(isolate()->factory()->undefined_value())); |
155 __ bind(&ok); | 155 __ bind(&ok); |
156 } | 156 } |
157 | 157 |
(...skipping 1983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 } | 2141 } |
2142 } | 2142 } |
2143 | 2143 |
2144 | 2144 |
2145 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2145 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
2146 ASSERT(ToRegister(instr->context()).is(esi)); | 2146 ASSERT(ToRegister(instr->context()).is(esi)); |
2147 ASSERT(ToRegister(instr->global_object()).is(edx)); | 2147 ASSERT(ToRegister(instr->global_object()).is(edx)); |
2148 ASSERT(ToRegister(instr->value()).is(eax)); | 2148 ASSERT(ToRegister(instr->value()).is(eax)); |
2149 | 2149 |
2150 __ mov(ecx, instr->name()); | 2150 __ mov(ecx, instr->name()); |
2151 Handle<Code> ic = instr->strict_mode() | 2151 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
2152 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2152 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
2153 : isolate()->builtins()->StoreIC_Initialize(); | 2153 : isolate()->builtins()->StoreIC_Initialize(); |
2154 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2154 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
2155 } | 2155 } |
2156 | 2156 |
2157 | 2157 |
2158 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2158 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2159 Register context = ToRegister(instr->context()); | 2159 Register context = ToRegister(instr->context()); |
2160 Register result = ToRegister(instr->result()); | 2160 Register result = ToRegister(instr->result()); |
2161 __ mov(result, ContextOperand(context, instr->slot_index())); | 2161 __ mov(result, ContextOperand(context, instr->slot_index())); |
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3206 } | 3206 } |
3207 } | 3207 } |
3208 | 3208 |
3209 | 3209 |
3210 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 3210 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
3211 ASSERT(ToRegister(instr->context()).is(esi)); | 3211 ASSERT(ToRegister(instr->context()).is(esi)); |
3212 ASSERT(ToRegister(instr->object()).is(edx)); | 3212 ASSERT(ToRegister(instr->object()).is(edx)); |
3213 ASSERT(ToRegister(instr->value()).is(eax)); | 3213 ASSERT(ToRegister(instr->value()).is(eax)); |
3214 | 3214 |
3215 __ mov(ecx, instr->name()); | 3215 __ mov(ecx, instr->name()); |
3216 Handle<Code> ic = instr->strict_mode() | 3216 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3217 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3217 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3218 : isolate()->builtins()->StoreIC_Initialize(); | 3218 : isolate()->builtins()->StoreIC_Initialize(); |
3219 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3219 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3220 } | 3220 } |
3221 | 3221 |
3222 | 3222 |
3223 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3223 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
3224 if (instr->index()->IsConstantOperand()) { | 3224 if (instr->index()->IsConstantOperand()) { |
3225 __ cmp(ToOperand(instr->length()), | 3225 __ cmp(ToOperand(instr->length()), |
3226 ToImmediate(LConstantOperand::cast(instr->index()))); | 3226 ToImmediate(LConstantOperand::cast(instr->index()))); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3338 __ movdbl(double_store_operand, value); | 3338 __ movdbl(double_store_operand, value); |
3339 } | 3339 } |
3340 | 3340 |
3341 | 3341 |
3342 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 3342 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
3343 ASSERT(ToRegister(instr->context()).is(esi)); | 3343 ASSERT(ToRegister(instr->context()).is(esi)); |
3344 ASSERT(ToRegister(instr->object()).is(edx)); | 3344 ASSERT(ToRegister(instr->object()).is(edx)); |
3345 ASSERT(ToRegister(instr->key()).is(ecx)); | 3345 ASSERT(ToRegister(instr->key()).is(ecx)); |
3346 ASSERT(ToRegister(instr->value()).is(eax)); | 3346 ASSERT(ToRegister(instr->value()).is(eax)); |
3347 | 3347 |
3348 Handle<Code> ic = instr->strict_mode() | 3348 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3349 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 3349 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
3350 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 3350 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
3351 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3351 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3352 } | 3352 } |
3353 | 3353 |
3354 | 3354 |
3355 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 3355 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
3356 Register object_reg = ToRegister(instr->object()); | 3356 Register object_reg = ToRegister(instr->object()); |
3357 Register new_map_reg = ToRegister(instr->new_map_reg()); | 3357 Register new_map_reg = ToRegister(instr->new_map_reg()); |
3358 | 3358 |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4309 } | 4309 } |
4310 | 4310 |
4311 | 4311 |
4312 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 4312 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
4313 ASSERT(ToRegister(instr->context()).is(esi)); | 4313 ASSERT(ToRegister(instr->context()).is(esi)); |
4314 // Use the fast case closure allocation code that allocates in new | 4314 // Use the fast case closure allocation code that allocates in new |
4315 // space for nested functions that don't need literals cloning. | 4315 // space for nested functions that don't need literals cloning. |
4316 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); | 4316 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); |
4317 bool pretenure = instr->hydrogen()->pretenure(); | 4317 bool pretenure = instr->hydrogen()->pretenure(); |
4318 if (!pretenure && shared_info->num_literals() == 0) { | 4318 if (!pretenure && shared_info->num_literals() == 0) { |
4319 FastNewClosureStub stub(shared_info->strict_mode_flag()); | 4319 FastNewClosureStub stub(shared_info->language_mode()); |
4320 __ push(Immediate(shared_info)); | 4320 __ push(Immediate(shared_info)); |
4321 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4321 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4322 } else { | 4322 } else { |
4323 __ push(Operand(ebp, StandardFrameConstants::kContextOffset)); | 4323 __ push(Operand(ebp, StandardFrameConstants::kContextOffset)); |
4324 __ push(Immediate(shared_info)); | 4324 __ push(Immediate(shared_info)); |
4325 __ push(Immediate(pretenure | 4325 __ push(Immediate(pretenure |
4326 ? factory()->true_value() | 4326 ? factory()->true_value() |
4327 : factory()->false_value())); | 4327 : factory()->false_value())); |
4328 CallRuntime(Runtime::kNewClosure, 3, instr); | 4328 CallRuntime(Runtime::kNewClosure, 3, instr); |
4329 } | 4329 } |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4586 env->deoptimization_index()); | 4586 env->deoptimization_index()); |
4587 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4587 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4588 } | 4588 } |
4589 | 4589 |
4590 | 4590 |
4591 #undef __ | 4591 #undef __ |
4592 | 4592 |
4593 } } // namespace v8::internal | 4593 } } // namespace v8::internal |
4594 | 4594 |
4595 #endif // V8_TARGET_ARCH_IA32 | 4595 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |