OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 #endif | 135 #endif |
136 | 136 |
137 // a1: Callee's JS function. | 137 // a1: Callee's JS function. |
138 // cp: Callee's context. | 138 // cp: Callee's context. |
139 // fp: Caller's frame pointer. | 139 // fp: Caller's frame pointer. |
140 // lr: Caller's pc. | 140 // lr: Caller's pc. |
141 | 141 |
142 // Sloppy mode functions and builtins need to replace the receiver with the | 142 // Sloppy mode functions and builtins need to replace the receiver with the |
143 // global proxy when called as functions (without an explicit receiver | 143 // global proxy when called as functions (without an explicit receiver |
144 // object). | 144 // object). |
145 if (info_->this_has_uses() && | 145 if (info_->this_has_uses() && is_sloppy(info_->language_mode()) && |
146 info_->strict_mode() == SLOPPY && | |
147 !info_->is_native()) { | 146 !info_->is_native()) { |
148 Label ok; | 147 Label ok; |
149 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; | 148 int receiver_offset = info_->scope()->num_parameters() * kPointerSize; |
150 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 149 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
151 __ lw(a2, MemOperand(sp, receiver_offset)); | 150 __ lw(a2, MemOperand(sp, receiver_offset)); |
152 __ Branch(&ok, ne, a2, Operand(at)); | 151 __ Branch(&ok, ne, a2, Operand(at)); |
153 | 152 |
154 __ lw(a2, GlobalObjectOperand()); | 153 __ lw(a2, GlobalObjectOperand()); |
155 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); | 154 __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalProxyOffset)); |
156 | 155 |
(...skipping 4090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4247 } | 4246 } |
4248 } | 4247 } |
4249 | 4248 |
4250 | 4249 |
4251 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4250 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4252 DCHECK(ToRegister(instr->context()).is(cp)); | 4251 DCHECK(ToRegister(instr->context()).is(cp)); |
4253 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4252 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4254 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4253 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4255 | 4254 |
4256 __ li(StoreDescriptor::NameRegister(), Operand(instr->name())); | 4255 __ li(StoreDescriptor::NameRegister(), Operand(instr->name())); |
4257 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); | 4256 Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode()); |
4258 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4257 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4259 } | 4258 } |
4260 | 4259 |
4261 | 4260 |
4262 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4261 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4263 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4262 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
4264 Operand operand(0); | 4263 Operand operand(0); |
4265 Register reg; | 4264 Register reg; |
4266 if (instr->index()->IsConstantOperand()) { | 4265 if (instr->index()->IsConstantOperand()) { |
4267 operand = ToOperand(instr->index()); | 4266 operand = ToOperand(instr->index()); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4479 } | 4478 } |
4480 | 4479 |
4481 | 4480 |
4482 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4481 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4483 DCHECK(ToRegister(instr->context()).is(cp)); | 4482 DCHECK(ToRegister(instr->context()).is(cp)); |
4484 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4483 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4485 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4484 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4486 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4485 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4487 | 4486 |
4488 Handle<Code> ic = | 4487 Handle<Code> ic = |
4489 CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); | 4488 CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code(); |
4490 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4489 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4491 } | 4490 } |
4492 | 4491 |
4493 | 4492 |
4494 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 4493 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
4495 Register object_reg = ToRegister(instr->object()); | 4494 Register object_reg = ToRegister(instr->object()); |
4496 Register scratch = scratch0(); | 4495 Register scratch = scratch0(); |
4497 | 4496 |
4498 Handle<Map> from_map = instr->original_map(); | 4497 Handle<Map> from_map = instr->original_map(); |
4499 Handle<Map> to_map = instr->transitioned_map(); | 4498 Handle<Map> to_map = instr->transitioned_map(); |
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5535 } | 5534 } |
5536 } | 5535 } |
5537 | 5536 |
5538 | 5537 |
5539 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 5538 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
5540 DCHECK(ToRegister(instr->context()).is(cp)); | 5539 DCHECK(ToRegister(instr->context()).is(cp)); |
5541 // Use the fast case closure allocation code that allocates in new | 5540 // Use the fast case closure allocation code that allocates in new |
5542 // space for nested functions that don't need literals cloning. | 5541 // space for nested functions that don't need literals cloning. |
5543 bool pretenure = instr->hydrogen()->pretenure(); | 5542 bool pretenure = instr->hydrogen()->pretenure(); |
5544 if (!pretenure && instr->hydrogen()->has_no_literals()) { | 5543 if (!pretenure && instr->hydrogen()->has_no_literals()) { |
5545 FastNewClosureStub stub(isolate(), instr->hydrogen()->strict_mode(), | 5544 FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(), |
5546 instr->hydrogen()->kind()); | 5545 instr->hydrogen()->kind()); |
5547 __ li(a2, Operand(instr->hydrogen()->shared_info())); | 5546 __ li(a2, Operand(instr->hydrogen()->shared_info())); |
5548 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 5547 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
5549 } else { | 5548 } else { |
5550 __ li(a2, Operand(instr->hydrogen()->shared_info())); | 5549 __ li(a2, Operand(instr->hydrogen()->shared_info())); |
5551 __ li(a1, Operand(pretenure ? factory()->true_value() | 5550 __ li(a1, Operand(pretenure ? factory()->true_value() |
5552 : factory()->false_value())); | 5551 : factory()->false_value())); |
5553 __ Push(cp, a2, a1); | 5552 __ Push(cp, a2, a1); |
5554 CallRuntime(Runtime::kNewClosure, 3, instr); | 5553 CallRuntime(Runtime::kNewClosure, 3, instr); |
5555 } | 5554 } |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5990 __ li(at, scope_info); | 5989 __ li(at, scope_info); |
5991 __ Push(at, ToRegister(instr->function())); | 5990 __ Push(at, ToRegister(instr->function())); |
5992 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5991 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5993 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5992 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5994 } | 5993 } |
5995 | 5994 |
5996 | 5995 |
5997 #undef __ | 5996 #undef __ |
5998 | 5997 |
5999 } } // namespace v8::internal | 5998 } } // namespace v8::internal |
OLD | NEW |