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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 #ifdef DEBUG | 102 #ifdef DEBUG |
103 if (strlen(FLAG_stop_at) > 0 && | 103 if (strlen(FLAG_stop_at) > 0 && |
104 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 104 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
105 __ int3(); | 105 __ int3(); |
106 } | 106 } |
107 #endif | 107 #endif |
108 | 108 |
109 // Sloppy mode functions and builtins need to replace the receiver with the | 109 // Sloppy mode functions and builtins need to replace the receiver with the |
110 // global proxy when called as functions (without an explicit receiver | 110 // global proxy when called as functions (without an explicit receiver |
111 // object). | 111 // object). |
112 if (info_->this_has_uses() && | 112 if (info_->this_has_uses() && is_sloppy(info_->language_mode()) && |
113 info_->strict_mode() == SLOPPY && | |
114 !info_->is_native()) { | 113 !info_->is_native()) { |
115 Label ok; | 114 Label ok; |
116 // +1 for return address. | 115 // +1 for return address. |
117 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; | 116 int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize; |
118 __ mov(ecx, Operand(esp, receiver_offset)); | 117 __ mov(ecx, Operand(esp, receiver_offset)); |
119 | 118 |
120 __ cmp(ecx, isolate()->factory()->undefined_value()); | 119 __ cmp(ecx, isolate()->factory()->undefined_value()); |
121 __ j(not_equal, &ok, Label::kNear); | 120 __ j(not_equal, &ok, Label::kNear); |
122 | 121 |
123 __ mov(ecx, GlobalObjectOperand()); | 122 __ mov(ecx, GlobalObjectOperand()); |
(...skipping 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4564 } | 4563 } |
4565 } | 4564 } |
4566 | 4565 |
4567 | 4566 |
4568 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4567 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4569 DCHECK(ToRegister(instr->context()).is(esi)); | 4568 DCHECK(ToRegister(instr->context()).is(esi)); |
4570 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4569 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4571 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4570 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4572 | 4571 |
4573 __ mov(StoreDescriptor::NameRegister(), instr->name()); | 4572 __ mov(StoreDescriptor::NameRegister(), instr->name()); |
4574 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); | 4573 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode()); |
4575 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4574 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4576 } | 4575 } |
4577 | 4576 |
4578 | 4577 |
4579 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4578 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4580 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; | 4579 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; |
4581 if (instr->index()->IsConstantOperand()) { | 4580 if (instr->index()->IsConstantOperand()) { |
4582 __ cmp(ToOperand(instr->length()), | 4581 __ cmp(ToOperand(instr->length()), |
4583 ToImmediate(LConstantOperand::cast(instr->index()), | 4582 ToImmediate(LConstantOperand::cast(instr->index()), |
4584 instr->hydrogen()->length()->representation())); | 4583 instr->hydrogen()->length()->representation())); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4795 } | 4794 } |
4796 | 4795 |
4797 | 4796 |
4798 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4797 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4799 DCHECK(ToRegister(instr->context()).is(esi)); | 4798 DCHECK(ToRegister(instr->context()).is(esi)); |
4800 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4799 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4801 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4800 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4802 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4801 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4803 | 4802 |
4804 Handle<Code> ic = | 4803 Handle<Code> ic = |
4805 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); | 4804 CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code(); |
4806 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4805 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4807 } | 4806 } |
4808 | 4807 |
4809 | 4808 |
4810 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { | 4809 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { |
4811 Register object = ToRegister(instr->object()); | 4810 Register object = ToRegister(instr->object()); |
4812 Register temp = ToRegister(instr->temp()); | 4811 Register temp = ToRegister(instr->temp()); |
4813 Label no_memento_found; | 4812 Label no_memento_found; |
4814 __ TestJSArrayForAllocationMemento(object, temp, &no_memento_found); | 4813 __ TestJSArrayForAllocationMemento(object, temp, &no_memento_found); |
4815 DeoptimizeIf(equal, instr, Deoptimizer::kMementoFound); | 4814 DeoptimizeIf(equal, instr, Deoptimizer::kMementoFound); |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5967 } | 5966 } |
5968 } | 5967 } |
5969 | 5968 |
5970 | 5969 |
5971 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 5970 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
5972 DCHECK(ToRegister(instr->context()).is(esi)); | 5971 DCHECK(ToRegister(instr->context()).is(esi)); |
5973 // Use the fast case closure allocation code that allocates in new | 5972 // Use the fast case closure allocation code that allocates in new |
5974 // space for nested functions that don't need literals cloning. | 5973 // space for nested functions that don't need literals cloning. |
5975 bool pretenure = instr->hydrogen()->pretenure(); | 5974 bool pretenure = instr->hydrogen()->pretenure(); |
5976 if (!pretenure && instr->hydrogen()->has_no_literals()) { | 5975 if (!pretenure && instr->hydrogen()->has_no_literals()) { |
5977 FastNewClosureStub stub(isolate(), instr->hydrogen()->strict_mode(), | 5976 FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), |
5978 instr->hydrogen()->kind()); | 5977 instr->hydrogen()->kind()); |
5979 __ mov(ebx, Immediate(instr->hydrogen()->shared_info())); | 5978 __ mov(ebx, Immediate(instr->hydrogen()->shared_info())); |
5980 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5979 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
5981 } else { | 5980 } else { |
5982 __ push(esi); | 5981 __ push(esi); |
5983 __ push(Immediate(instr->hydrogen()->shared_info())); | 5982 __ push(Immediate(instr->hydrogen()->shared_info())); |
5984 __ push(Immediate(pretenure ? factory()->true_value() | 5983 __ push(Immediate(pretenure ? factory()->true_value() |
5985 : factory()->false_value())); | 5984 : factory()->false_value())); |
5986 CallRuntime(Runtime::kNewClosure, 3, instr); | 5985 CallRuntime(Runtime::kNewClosure, 3, instr); |
5987 } | 5986 } |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6380 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6379 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6381 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6380 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6382 } | 6381 } |
6383 | 6382 |
6384 | 6383 |
6385 #undef __ | 6384 #undef __ |
6386 | 6385 |
6387 } } // namespace v8::internal | 6386 } } // namespace v8::internal |
6388 | 6387 |
6389 #endif // V8_TARGET_ARCH_X87 | 6388 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |