| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 #ifdef DEBUG | 133 #ifdef DEBUG |
| 134 if (strlen(FLAG_stop_at) > 0 && | 134 if (strlen(FLAG_stop_at) > 0 && |
| 135 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 135 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
| 136 __ int3(); | 136 __ int3(); |
| 137 } | 137 } |
| 138 #endif | 138 #endif |
| 139 | 139 |
| 140 // Sloppy mode functions and builtins need to replace the receiver with the | 140 // Sloppy mode functions and builtins need to replace the receiver with the |
| 141 // global proxy when called as functions (without an explicit receiver | 141 // global proxy when called as functions (without an explicit receiver |
| 142 // object). | 142 // object). |
| 143 if (info_->this_has_uses() && | 143 if (info_->this_has_uses() && is_sloppy(info_->language_mode()) && |
| 144 info_->strict_mode() == SLOPPY && | |
| 145 !info_->is_native()) { | 144 !info_->is_native()) { |
| 146 Label ok; | 145 Label ok; |
| 147 // +1 for return address. | 146 // +1 for return address. |
| 148 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; | 147 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; |
| 149 __ mov(ecx, Operand(esp, receiver_offset)); | 148 __ mov(ecx, Operand(esp, receiver_offset)); |
| 150 | 149 |
| 151 __ cmp(ecx, isolate()->factory()->undefined_value()); | 150 __ cmp(ecx, isolate()->factory()->undefined_value()); |
| 152 __ j(not_equal, &ok, Label::kNear); | 151 __ j(not_equal, &ok, Label::kNear); |
| 153 | 152 |
| 154 __ mov(ecx, GlobalObjectOperand()); | 153 __ mov(ecx, GlobalObjectOperand()); |
| (...skipping 4012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4167 } | 4166 } |
| 4168 } | 4167 } |
| 4169 | 4168 |
| 4170 | 4169 |
| 4171 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4170 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 4172 DCHECK(ToRegister(instr->context()).is(esi)); | 4171 DCHECK(ToRegister(instr->context()).is(esi)); |
| 4173 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4172 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
| 4174 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4173 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
| 4175 | 4174 |
| 4176 __ mov(StoreDescriptor::NameRegister(), instr->name()); | 4175 __ mov(StoreDescriptor::NameRegister(), instr->name()); |
| 4177 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); | 4176 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode()); |
| 4178 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4177 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4179 } | 4178 } |
| 4180 | 4179 |
| 4181 | 4180 |
| 4182 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4181 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4183 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; | 4182 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; |
| 4184 if (instr->index()->IsConstantOperand()) { | 4183 if (instr->index()->IsConstantOperand()) { |
| 4185 __ cmp(ToOperand(instr->length()), | 4184 __ cmp(ToOperand(instr->length()), |
| 4186 ToImmediate(LConstantOperand::cast(instr->index()), | 4185 ToImmediate(LConstantOperand::cast(instr->index()), |
| 4187 instr->hydrogen()->length()->representation())); | 4186 instr->hydrogen()->length()->representation())); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4345 } | 4344 } |
| 4346 | 4345 |
| 4347 | 4346 |
| 4348 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4347 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| 4349 DCHECK(ToRegister(instr->context()).is(esi)); | 4348 DCHECK(ToRegister(instr->context()).is(esi)); |
| 4350 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4349 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
| 4351 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4350 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
| 4352 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4351 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
| 4353 | 4352 |
| 4354 Handle<Code> ic = | 4353 Handle<Code> ic = |
| 4355 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); | 4354 CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code(); |
| 4356 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4355 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4357 } | 4356 } |
| 4358 | 4357 |
| 4359 | 4358 |
| 4360 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { | 4359 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { |
| 4361 Register object = ToRegister(instr->object()); | 4360 Register object = ToRegister(instr->object()); |
| 4362 Register temp = ToRegister(instr->temp()); | 4361 Register temp = ToRegister(instr->temp()); |
| 4363 Label no_memento_found; | 4362 Label no_memento_found; |
| 4364 __ TestJSArrayForAllocationMemento(object, temp, &no_memento_found); | 4363 __ TestJSArrayForAllocationMemento(object, temp, &no_memento_found); |
| 4365 DeoptimizeIf(equal, instr, "memento found"); | 4364 DeoptimizeIf(equal, instr, "memento found"); |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5362 } | 5361 } |
| 5363 } | 5362 } |
| 5364 | 5363 |
| 5365 | 5364 |
| 5366 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 5365 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
| 5367 DCHECK(ToRegister(instr->context()).is(esi)); | 5366 DCHECK(ToRegister(instr->context()).is(esi)); |
| 5368 // Use the fast case closure allocation code that allocates in new | 5367 // Use the fast case closure allocation code that allocates in new |
| 5369 // space for nested functions that don't need literals cloning. | 5368 // space for nested functions that don't need literals cloning. |
| 5370 bool pretenure = instr->hydrogen()->pretenure(); | 5369 bool pretenure = instr->hydrogen()->pretenure(); |
| 5371 if (!pretenure && instr->hydrogen()->has_no_literals()) { | 5370 if (!pretenure && instr->hydrogen()->has_no_literals()) { |
| 5372 FastNewClosureStub stub(isolate(), instr->hydrogen()->strict_mode(), | 5371 FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), |
| 5373 instr->hydrogen()->kind()); | 5372 instr->hydrogen()->kind()); |
| 5374 __ mov(ebx, Immediate(instr->hydrogen()->shared_info())); | 5373 __ mov(ebx, Immediate(instr->hydrogen()->shared_info())); |
| 5375 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5374 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5376 } else { | 5375 } else { |
| 5377 __ push(esi); | 5376 __ push(esi); |
| 5378 __ push(Immediate(instr->hydrogen()->shared_info())); | 5377 __ push(Immediate(instr->hydrogen()->shared_info())); |
| 5379 __ push(Immediate(pretenure ? factory()->true_value() | 5378 __ push(Immediate(pretenure ? factory()->true_value() |
| 5380 : factory()->false_value())); | 5379 : factory()->false_value())); |
| 5381 CallRuntime(Runtime::kNewClosure, 3, instr); | 5380 CallRuntime(Runtime::kNewClosure, 3, instr); |
| 5382 } | 5381 } |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5772 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5771 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5773 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5772 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5774 } | 5773 } |
| 5775 | 5774 |
| 5776 | 5775 |
| 5777 #undef __ | 5776 #undef __ |
| 5778 | 5777 |
| 5779 } } // namespace v8::internal | 5778 } } // namespace v8::internal |
| 5780 | 5779 |
| 5781 #endif // V8_TARGET_ARCH_IA32 | 5780 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |