| 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 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/hydrogen-osr.h" | 9 #include "src/hydrogen-osr.h" |
| 10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #endif | 110 #endif |
| 111 | 111 |
| 112 // a1: Callee's JS function. | 112 // a1: Callee's JS function. |
| 113 // cp: Callee's context. | 113 // cp: Callee's context. |
| 114 // fp: Caller's frame pointer. | 114 // fp: Caller's frame pointer. |
| 115 // lr: Caller's pc. | 115 // lr: Caller's pc. |
| 116 | 116 |
| 117 // Sloppy mode functions and builtins need to replace the receiver with the | 117 // Sloppy mode functions and builtins need to replace the receiver with the |
| 118 // global proxy when called as functions (without an explicit receiver | 118 // global proxy when called as functions (without an explicit receiver |
| 119 // object). | 119 // object). |
| 120 if (info_->this_has_uses() && | 120 if (info_->this_has_uses() && is_sloppy(info_->language_mode()) && |
| 121 info_->strict_mode() == SLOPPY && | |
| 122 !info_->is_native()) { | 121 !info_->is_native()) { |
| 123 Label ok; | 122 Label ok; |
| 124 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; | 123 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; |
| 125 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 124 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
| 126 __ ld(a2, MemOperand(sp, receiver_offset)); | 125 __ ld(a2, MemOperand(sp, receiver_offset)); |
| 127 __ Branch(&ok, ne, a2, Operand(at)); | 126 __ Branch(&ok, ne, a2, Operand(at)); |
| 128 | 127 |
| 129 __ ld(a2, GlobalObjectOperand()); | 128 __ ld(a2, GlobalObjectOperand()); |
| 130 __ ld(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); | 129 __ ld(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); |
| 131 | 130 |
| (...skipping 4144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4276 } | 4275 } |
| 4277 } | 4276 } |
| 4278 | 4277 |
| 4279 | 4278 |
| 4280 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4279 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
| 4281 DCHECK(ToRegister(instr->context()).is(cp)); | 4280 DCHECK(ToRegister(instr->context()).is(cp)); |
| 4282 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4281 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
| 4283 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4282 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
| 4284 | 4283 |
| 4285 __ li(StoreDescriptor::NameRegister(), Operand(instr->name())); | 4284 __ li(StoreDescriptor::NameRegister(), Operand(instr->name())); |
| 4286 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); | 4285 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode()); |
| 4287 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4286 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4288 } | 4287 } |
| 4289 | 4288 |
| 4290 | 4289 |
| 4291 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4290 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4292 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4291 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
| 4293 Operand operand((int64_t)0); | 4292 Operand operand((int64_t)0); |
| 4294 Register reg; | 4293 Register reg; |
| 4295 if (instr->index()->IsConstantOperand()) { | 4294 if (instr->index()->IsConstantOperand()) { |
| 4296 operand = ToOperand(instr->index()); | 4295 operand = ToOperand(instr->index()); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4541 } | 4540 } |
| 4542 | 4541 |
| 4543 | 4542 |
| 4544 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4543 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
| 4545 DCHECK(ToRegister(instr->context()).is(cp)); | 4544 DCHECK(ToRegister(instr->context()).is(cp)); |
| 4546 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4545 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
| 4547 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4546 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
| 4548 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4547 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
| 4549 | 4548 |
| 4550 Handle<Code> ic = | 4549 Handle<Code> ic = |
| 4551 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); | 4550 CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code(); |
| 4552 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4551 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4553 } | 4552 } |
| 4554 | 4553 |
| 4555 | 4554 |
| 4556 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 4555 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
| 4557 Register object_reg = ToRegister(instr->object()); | 4556 Register object_reg = ToRegister(instr->object()); |
| 4558 Register scratch = scratch0(); | 4557 Register scratch = scratch0(); |
| 4559 | 4558 |
| 4560 Handle<Map> from_map = instr->original_map(); | 4559 Handle<Map> from_map = instr->original_map(); |
| 4561 Handle<Map> to_map = instr->transitioned_map(); | 4560 Handle<Map> to_map = instr->transitioned_map(); |
| (...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5565 } | 5564 } |
| 5566 } | 5565 } |
| 5567 | 5566 |
| 5568 | 5567 |
| 5569 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 5568 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
| 5570 DCHECK(ToRegister(instr->context()).is(cp)); | 5569 DCHECK(ToRegister(instr->context()).is(cp)); |
| 5571 // Use the fast case closure allocation code that allocates in new | 5570 // Use the fast case closure allocation code that allocates in new |
| 5572 // space for nested functions that don't need literals cloning. | 5571 // space for nested functions that don't need literals cloning. |
| 5573 bool pretenure = instr->hydrogen()->pretenure(); | 5572 bool pretenure = instr->hydrogen()->pretenure(); |
| 5574 if (!pretenure && instr->hydrogen()->has_no_literals()) { | 5573 if (!pretenure && instr->hydrogen()->has_no_literals()) { |
| 5575 FastNewClosureStub stub(isolate(), instr->hydrogen()->strict_mode(), | 5574 FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), |
| 5576 instr->hydrogen()->kind()); | 5575 instr->hydrogen()->kind()); |
| 5577 __ li(a2, Operand(instr->hydrogen()->shared_info())); | 5576 __ li(a2, Operand(instr->hydrogen()->shared_info())); |
| 5578 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5577 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| 5579 } else { | 5578 } else { |
| 5580 __ li(a2, Operand(instr->hydrogen()->shared_info())); | 5579 __ li(a2, Operand(instr->hydrogen()->shared_info())); |
| 5581 __ li(a1, Operand(pretenure ? factory()->true_value() | 5580 __ li(a1, Operand(pretenure ? factory()->true_value() |
| 5582 : factory()->false_value())); | 5581 : factory()->false_value())); |
| 5583 __ Push(cp, a2, a1); | 5582 __ Push(cp, a2, a1); |
| 5584 CallRuntime(Runtime::kNewClosure, 3, instr); | 5583 CallRuntime(Runtime::kNewClosure, 3, instr); |
| 5585 } | 5584 } |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6018 __ li(at, scope_info); | 6017 __ li(at, scope_info); |
| 6019 __ Push(at, ToRegister(instr->function())); | 6018 __ Push(at, ToRegister(instr->function())); |
| 6020 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6019 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6021 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6020 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6022 } | 6021 } |
| 6023 | 6022 |
| 6024 | 6023 |
| 6025 #undef __ | 6024 #undef __ |
| 6026 | 6025 |
| 6027 } } // namespace v8::internal | 6026 } } // namespace v8::internal |
| OLD | NEW |