OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 // r1: Callee's JS function. | 153 // r1: Callee's JS function. |
154 // cp: Callee's context. | 154 // cp: Callee's context. |
155 // fp: Caller's frame pointer. | 155 // fp: Caller's frame pointer. |
156 // lr: Caller's pc. | 156 // lr: Caller's pc. |
157 | 157 |
158 // Strict mode functions and builtins need to replace the receiver | 158 // Strict mode functions and builtins need to replace the receiver |
159 // with undefined when called as functions (without an explicit | 159 // with undefined when called as functions (without an explicit |
160 // receiver object). r5 is zero for method calls and non-zero for | 160 // receiver object). r5 is zero for method calls and non-zero for |
161 // function calls. | 161 // function calls. |
162 if (info_->is_strict_mode() || info_->is_native()) { | 162 if (!info_->is_classic_mode() || info_->is_native()) { |
163 Label ok; | 163 Label ok; |
164 __ cmp(r5, Operand(0)); | 164 __ cmp(r5, Operand(0)); |
165 __ b(eq, &ok); | 165 __ b(eq, &ok); |
166 int receiver_offset = scope()->num_parameters() * kPointerSize; | 166 int receiver_offset = scope()->num_parameters() * kPointerSize; |
167 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 167 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
168 __ str(r2, MemOperand(sp, receiver_offset)); | 168 __ str(r2, MemOperand(sp, receiver_offset)); |
169 __ bind(&ok); | 169 __ bind(&ok); |
170 } | 170 } |
171 | 171 |
172 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); | 172 __ stm(db_w, sp, r1.bit() | cp.bit() | fp.bit() | lr.bit()); |
(...skipping 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2282 check_needed); | 2282 check_needed); |
2283 } | 2283 } |
2284 } | 2284 } |
2285 | 2285 |
2286 | 2286 |
2287 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2287 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
2288 ASSERT(ToRegister(instr->global_object()).is(r1)); | 2288 ASSERT(ToRegister(instr->global_object()).is(r1)); |
2289 ASSERT(ToRegister(instr->value()).is(r0)); | 2289 ASSERT(ToRegister(instr->value()).is(r0)); |
2290 | 2290 |
2291 __ mov(r2, Operand(instr->name())); | 2291 __ mov(r2, Operand(instr->name())); |
2292 Handle<Code> ic = instr->strict_mode() | 2292 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
2293 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2293 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
2294 : isolate()->builtins()->StoreIC_Initialize(); | 2294 : isolate()->builtins()->StoreIC_Initialize(); |
2295 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2295 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
2296 } | 2296 } |
2297 | 2297 |
2298 | 2298 |
2299 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2299 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2300 Register context = ToRegister(instr->context()); | 2300 Register context = ToRegister(instr->context()); |
2301 Register result = ToRegister(instr->result()); | 2301 Register result = ToRegister(instr->result()); |
2302 __ ldr(result, ContextOperand(context, instr->slot_index())); | 2302 __ ldr(result, ContextOperand(context, instr->slot_index())); |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3359 } | 3359 } |
3360 } | 3360 } |
3361 | 3361 |
3362 | 3362 |
3363 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 3363 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
3364 ASSERT(ToRegister(instr->object()).is(r1)); | 3364 ASSERT(ToRegister(instr->object()).is(r1)); |
3365 ASSERT(ToRegister(instr->value()).is(r0)); | 3365 ASSERT(ToRegister(instr->value()).is(r0)); |
3366 | 3366 |
3367 // Name is always in r2. | 3367 // Name is always in r2. |
3368 __ mov(r2, Operand(instr->name())); | 3368 __ mov(r2, Operand(instr->name())); |
3369 Handle<Code> ic = instr->strict_mode() | 3369 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3370 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3370 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3371 : isolate()->builtins()->StoreIC_Initialize(); | 3371 : isolate()->builtins()->StoreIC_Initialize(); |
3372 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3372 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3373 } | 3373 } |
3374 | 3374 |
3375 | 3375 |
3376 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3376 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
3377 __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); | 3377 __ cmp(ToRegister(instr->index()), ToRegister(instr->length())); |
3378 DeoptimizeIf(hs, instr->environment()); | 3378 DeoptimizeIf(hs, instr->environment()); |
3379 } | 3379 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3525 } | 3525 } |
3526 } | 3526 } |
3527 } | 3527 } |
3528 | 3528 |
3529 | 3529 |
3530 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 3530 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
3531 ASSERT(ToRegister(instr->object()).is(r2)); | 3531 ASSERT(ToRegister(instr->object()).is(r2)); |
3532 ASSERT(ToRegister(instr->key()).is(r1)); | 3532 ASSERT(ToRegister(instr->key()).is(r1)); |
3533 ASSERT(ToRegister(instr->value()).is(r0)); | 3533 ASSERT(ToRegister(instr->value()).is(r0)); |
3534 | 3534 |
3535 Handle<Code> ic = instr->strict_mode() | 3535 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3536 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 3536 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
3537 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 3537 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
3538 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3538 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3539 } | 3539 } |
3540 | 3540 |
3541 | 3541 |
3542 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 3542 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
3543 Register object_reg = ToRegister(instr->object()); | 3543 Register object_reg = ToRegister(instr->object()); |
3544 Register new_map_reg = ToRegister(instr->new_map_reg()); | 3544 Register new_map_reg = ToRegister(instr->new_map_reg()); |
3545 Register scratch = scratch0(); | 3545 Register scratch = scratch0(); |
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4412 } | 4412 } |
4413 } | 4413 } |
4414 | 4414 |
4415 | 4415 |
4416 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 4416 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
4417 // Use the fast case closure allocation code that allocates in new | 4417 // Use the fast case closure allocation code that allocates in new |
4418 // space for nested functions that don't need literals cloning. | 4418 // space for nested functions that don't need literals cloning. |
4419 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); | 4419 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); |
4420 bool pretenure = instr->hydrogen()->pretenure(); | 4420 bool pretenure = instr->hydrogen()->pretenure(); |
4421 if (!pretenure && shared_info->num_literals() == 0) { | 4421 if (!pretenure && shared_info->num_literals() == 0) { |
4422 FastNewClosureStub stub(shared_info->strict_mode_flag()); | 4422 FastNewClosureStub stub(shared_info->language_mode()); |
4423 __ mov(r1, Operand(shared_info)); | 4423 __ mov(r1, Operand(shared_info)); |
4424 __ push(r1); | 4424 __ push(r1); |
4425 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4425 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4426 } else { | 4426 } else { |
4427 __ mov(r2, Operand(shared_info)); | 4427 __ mov(r2, Operand(shared_info)); |
4428 __ mov(r1, Operand(pretenure | 4428 __ mov(r1, Operand(pretenure |
4429 ? factory()->true_value() | 4429 ? factory()->true_value() |
4430 : factory()->false_value())); | 4430 : factory()->false_value())); |
4431 __ Push(cp, r2, r1); | 4431 __ Push(cp, r2, r1); |
4432 CallRuntime(Runtime::kNewClosure, 3, instr); | 4432 CallRuntime(Runtime::kNewClosure, 3, instr); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4668 ASSERT(osr_pc_offset_ == -1); | 4668 ASSERT(osr_pc_offset_ == -1); |
4669 osr_pc_offset_ = masm()->pc_offset(); | 4669 osr_pc_offset_ = masm()->pc_offset(); |
4670 } | 4670 } |
4671 | 4671 |
4672 | 4672 |
4673 | 4673 |
4674 | 4674 |
4675 #undef __ | 4675 #undef __ |
4676 | 4676 |
4677 } } // namespace v8::internal | 4677 } } // namespace v8::internal |
OLD | NEW |