OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 #ifdef DEBUG | 122 #ifdef DEBUG |
123 if (strlen(FLAG_stop_at) > 0 && | 123 if (strlen(FLAG_stop_at) > 0 && |
124 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { | 124 info_->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { |
125 __ int3(); | 125 __ int3(); |
126 } | 126 } |
127 #endif | 127 #endif |
128 | 128 |
129 // Sloppy mode functions need to replace the receiver with the global proxy | 129 // Sloppy mode functions need to replace the receiver with the global proxy |
130 // when called as functions (without an explicit receiver object). | 130 // when called as functions (without an explicit receiver object). |
131 if (info_->this_has_uses() && | 131 if (info_->this_has_uses() && is_sloppy(info_->language_mode()) && |
132 info_->strict_mode() == SLOPPY && | |
133 !info_->is_native()) { | 132 !info_->is_native()) { |
134 Label ok; | 133 Label ok; |
135 StackArgumentsAccessor args(rsp, scope()->num_parameters()); | 134 StackArgumentsAccessor args(rsp, scope()->num_parameters()); |
136 __ movp(rcx, args.GetReceiverOperand()); | 135 __ movp(rcx, args.GetReceiverOperand()); |
137 | 136 |
138 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); | 137 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); |
139 __ j(not_equal, &ok, Label::kNear); | 138 __ j(not_equal, &ok, Label::kNear); |
140 | 139 |
141 __ movp(rcx, GlobalObjectOperand()); | 140 __ movp(rcx, GlobalObjectOperand()); |
142 __ movp(rcx, FieldOperand(rcx, GlobalObject::kGlobalProxyOffset)); | 141 __ movp(rcx, FieldOperand(rcx, GlobalObject::kGlobalProxyOffset)); |
(...skipping 4121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4264 } | 4263 } |
4265 } | 4264 } |
4266 | 4265 |
4267 | 4266 |
4268 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4267 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4269 DCHECK(ToRegister(instr->context()).is(rsi)); | 4268 DCHECK(ToRegister(instr->context()).is(rsi)); |
4270 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4269 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4271 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4270 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4272 | 4271 |
4273 __ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name()); | 4272 __ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name()); |
4274 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); | 4273 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode()); |
4275 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4274 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4276 } | 4275 } |
4277 | 4276 |
4278 | 4277 |
4279 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4278 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4280 Representation representation = instr->hydrogen()->length()->representation(); | 4279 Representation representation = instr->hydrogen()->length()->representation(); |
4281 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 4280 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
4282 DCHECK(representation.IsSmiOrInteger32()); | 4281 DCHECK(representation.IsSmiOrInteger32()); |
4283 | 4282 |
4284 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; | 4283 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4524 } | 4523 } |
4525 | 4524 |
4526 | 4525 |
4527 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4526 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4528 DCHECK(ToRegister(instr->context()).is(rsi)); | 4527 DCHECK(ToRegister(instr->context()).is(rsi)); |
4529 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4528 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4530 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4529 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4531 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4530 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4532 | 4531 |
4533 Handle<Code> ic = | 4532 Handle<Code> ic = |
4534 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); | 4533 CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code(); |
4535 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4534 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4536 } | 4535 } |
4537 | 4536 |
4538 | 4537 |
4539 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 4538 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
4540 Register object_reg = ToRegister(instr->object()); | 4539 Register object_reg = ToRegister(instr->object()); |
4541 | 4540 |
4542 Handle<Map> from_map = instr->original_map(); | 4541 Handle<Map> from_map = instr->original_map(); |
4543 Handle<Map> to_map = instr->transitioned_map(); | 4542 Handle<Map> to_map = instr->transitioned_map(); |
4544 ElementsKind from_kind = instr->from_kind(); | 4543 ElementsKind from_kind = instr->from_kind(); |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5508 } | 5507 } |
5509 } | 5508 } |
5510 | 5509 |
5511 | 5510 |
5512 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 5511 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
5513 DCHECK(ToRegister(instr->context()).is(rsi)); | 5512 DCHECK(ToRegister(instr->context()).is(rsi)); |
5514 // Use the fast case closure allocation code that allocates in new | 5513 // Use the fast case closure allocation code that allocates in new |
5515 // space for nested functions that don't need literals cloning. | 5514 // space for nested functions that don't need literals cloning. |
5516 bool pretenure = instr->hydrogen()->pretenure(); | 5515 bool pretenure = instr->hydrogen()->pretenure(); |
5517 if (!pretenure && instr->hydrogen()->has_no_literals()) { | 5516 if (!pretenure && instr->hydrogen()->has_no_literals()) { |
5518 FastNewClosureStub stub(isolate(), instr->hydrogen()->strict_mode(), | 5517 FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), |
5519 instr->hydrogen()->kind()); | 5518 instr->hydrogen()->kind()); |
5520 __ Move(rbx, instr->hydrogen()->shared_info()); | 5519 __ Move(rbx, instr->hydrogen()->shared_info()); |
5521 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5520 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
5522 } else { | 5521 } else { |
5523 __ Push(rsi); | 5522 __ Push(rsi); |
5524 __ Push(instr->hydrogen()->shared_info()); | 5523 __ Push(instr->hydrogen()->shared_info()); |
5525 __ PushRoot(pretenure ? Heap::kTrueValueRootIndex : | 5524 __ PushRoot(pretenure ? Heap::kTrueValueRootIndex : |
5526 Heap::kFalseValueRootIndex); | 5525 Heap::kFalseValueRootIndex); |
5527 CallRuntime(Runtime::kNewClosure, 3, instr); | 5526 CallRuntime(Runtime::kNewClosure, 3, instr); |
5528 } | 5527 } |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5930 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5929 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5931 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5930 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5932 } | 5931 } |
5933 | 5932 |
5934 | 5933 |
5935 #undef __ | 5934 #undef __ |
5936 | 5935 |
5937 } } // namespace v8::internal | 5936 } } // namespace v8::internal |
5938 | 5937 |
5939 #endif // V8_TARGET_ARCH_X64 | 5938 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |