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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 // a1: Callee's JS function. | 151 // a1: Callee's JS function. |
152 // cp: Callee's context. | 152 // cp: Callee's context. |
153 // fp: Caller's frame pointer. | 153 // fp: Caller's frame pointer. |
154 // lr: Caller's pc. | 154 // lr: Caller's pc. |
155 | 155 |
156 // Strict mode functions and builtins need to replace the receiver | 156 // Strict mode functions and builtins need to replace the receiver |
157 // with undefined when called as functions (without an explicit | 157 // with undefined when called as functions (without an explicit |
158 // receiver object). r5 is zero for method calls and non-zero for | 158 // receiver object). r5 is zero for method calls and non-zero for |
159 // function calls. | 159 // function calls. |
160 if (info_->is_strict_mode() || info_->is_native()) { | 160 if (!info_->is_classic_mode() || info_->is_native()) { |
161 Label ok; | 161 Label ok; |
162 __ Branch(&ok, eq, t1, Operand(zero_reg)); | 162 __ Branch(&ok, eq, t1, Operand(zero_reg)); |
163 | 163 |
164 int receiver_offset = scope()->num_parameters() * kPointerSize; | 164 int receiver_offset = scope()->num_parameters() * kPointerSize; |
165 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); | 165 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); |
166 __ sw(a2, MemOperand(sp, receiver_offset)); | 166 __ sw(a2, MemOperand(sp, receiver_offset)); |
167 __ bind(&ok); | 167 __ bind(&ok); |
168 } | 168 } |
169 | 169 |
170 __ Push(ra, fp, cp, a1); | 170 __ Push(ra, fp, cp, a1); |
(...skipping 1994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 check_needed); | 2165 check_needed); |
2166 } | 2166 } |
2167 } | 2167 } |
2168 | 2168 |
2169 | 2169 |
2170 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { | 2170 void LCodeGen::DoStoreGlobalGeneric(LStoreGlobalGeneric* instr) { |
2171 ASSERT(ToRegister(instr->global_object()).is(a1)); | 2171 ASSERT(ToRegister(instr->global_object()).is(a1)); |
2172 ASSERT(ToRegister(instr->value()).is(a0)); | 2172 ASSERT(ToRegister(instr->value()).is(a0)); |
2173 | 2173 |
2174 __ li(a2, Operand(instr->name())); | 2174 __ li(a2, Operand(instr->name())); |
2175 Handle<Code> ic = instr->strict_mode() | 2175 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
2176 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 2176 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
2177 : isolate()->builtins()->StoreIC_Initialize(); | 2177 : isolate()->builtins()->StoreIC_Initialize(); |
2178 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); | 2178 CallCode(ic, RelocInfo::CODE_TARGET_CONTEXT, instr); |
2179 } | 2179 } |
2180 | 2180 |
2181 | 2181 |
2182 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2182 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2183 Register context = ToRegister(instr->context()); | 2183 Register context = ToRegister(instr->context()); |
2184 Register result = ToRegister(instr->result()); | 2184 Register result = ToRegister(instr->result()); |
2185 __ lw(result, ContextOperand(context, instr->slot_index())); | 2185 __ lw(result, ContextOperand(context, instr->slot_index())); |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3264 } | 3264 } |
3265 } | 3265 } |
3266 | 3266 |
3267 | 3267 |
3268 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 3268 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
3269 ASSERT(ToRegister(instr->object()).is(a1)); | 3269 ASSERT(ToRegister(instr->object()).is(a1)); |
3270 ASSERT(ToRegister(instr->value()).is(a0)); | 3270 ASSERT(ToRegister(instr->value()).is(a0)); |
3271 | 3271 |
3272 // Name is always in a2. | 3272 // Name is always in a2. |
3273 __ li(a2, Operand(instr->name())); | 3273 __ li(a2, Operand(instr->name())); |
3274 Handle<Code> ic = instr->strict_mode() | 3274 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3275 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3275 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3276 : isolate()->builtins()->StoreIC_Initialize(); | 3276 : isolate()->builtins()->StoreIC_Initialize(); |
3277 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3277 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3278 } | 3278 } |
3279 | 3279 |
3280 | 3280 |
3281 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3281 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
3282 DeoptimizeIf(hs, | 3282 DeoptimizeIf(hs, |
3283 instr->environment(), | 3283 instr->environment(), |
3284 ToRegister(instr->index()), | 3284 ToRegister(instr->index()), |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3445 break; | 3445 break; |
3446 } | 3446 } |
3447 } | 3447 } |
3448 } | 3448 } |
3449 | 3449 |
3450 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 3450 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
3451 ASSERT(ToRegister(instr->object()).is(a2)); | 3451 ASSERT(ToRegister(instr->object()).is(a2)); |
3452 ASSERT(ToRegister(instr->key()).is(a1)); | 3452 ASSERT(ToRegister(instr->key()).is(a1)); |
3453 ASSERT(ToRegister(instr->value()).is(a0)); | 3453 ASSERT(ToRegister(instr->value()).is(a0)); |
3454 | 3454 |
3455 Handle<Code> ic = instr->strict_mode() | 3455 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3456 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() | 3456 ? isolate()->builtins()->KeyedStoreIC_Initialize_Strict() |
3457 : isolate()->builtins()->KeyedStoreIC_Initialize(); | 3457 : isolate()->builtins()->KeyedStoreIC_Initialize(); |
3458 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3458 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3459 } | 3459 } |
3460 | 3460 |
3461 | 3461 |
3462 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { | 3462 void LCodeGen::DoTransitionElementsKind(LTransitionElementsKind* instr) { |
3463 Register object_reg = ToRegister(instr->object()); | 3463 Register object_reg = ToRegister(instr->object()); |
3464 Register new_map_reg = ToRegister(instr->new_map_reg()); | 3464 Register new_map_reg = ToRegister(instr->new_map_reg()); |
3465 Register scratch = scratch0(); | 3465 Register scratch = scratch0(); |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4331 } | 4331 } |
4332 } | 4332 } |
4333 | 4333 |
4334 | 4334 |
4335 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { | 4335 void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { |
4336 // Use the fast case closure allocation code that allocates in new | 4336 // Use the fast case closure allocation code that allocates in new |
4337 // space for nested functions that don't need literals cloning. | 4337 // space for nested functions that don't need literals cloning. |
4338 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); | 4338 Handle<SharedFunctionInfo> shared_info = instr->shared_info(); |
4339 bool pretenure = instr->hydrogen()->pretenure(); | 4339 bool pretenure = instr->hydrogen()->pretenure(); |
4340 if (!pretenure && shared_info->num_literals() == 0) { | 4340 if (!pretenure && shared_info->num_literals() == 0) { |
4341 FastNewClosureStub stub(shared_info->strict_mode_flag()); | 4341 FastNewClosureStub stub(shared_info->language_mode()); |
4342 __ li(a1, Operand(shared_info)); | 4342 __ li(a1, Operand(shared_info)); |
4343 __ push(a1); | 4343 __ push(a1); |
4344 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); | 4344 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
4345 } else { | 4345 } else { |
4346 __ li(a2, Operand(shared_info)); | 4346 __ li(a2, Operand(shared_info)); |
4347 __ li(a1, Operand(pretenure | 4347 __ li(a1, Operand(pretenure |
4348 ? factory()->true_value() | 4348 ? factory()->true_value() |
4349 : factory()->false_value())); | 4349 : factory()->false_value())); |
4350 __ Push(cp, a2, a1); | 4350 __ Push(cp, a2, a1); |
4351 CallRuntime(Runtime::kNewClosure, 3, instr); | 4351 CallRuntime(Runtime::kNewClosure, 3, instr); |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4622 ASSERT(!environment->HasBeenRegistered()); | 4622 ASSERT(!environment->HasBeenRegistered()); |
4623 RegisterEnvironmentForDeoptimization(environment); | 4623 RegisterEnvironmentForDeoptimization(environment); |
4624 ASSERT(osr_pc_offset_ == -1); | 4624 ASSERT(osr_pc_offset_ == -1); |
4625 osr_pc_offset_ = masm()->pc_offset(); | 4625 osr_pc_offset_ = masm()->pc_offset(); |
4626 } | 4626 } |
4627 | 4627 |
4628 | 4628 |
4629 #undef __ | 4629 #undef __ |
4630 | 4630 |
4631 } } // namespace v8::internal | 4631 } } // namespace v8::internal |
OLD | NEW |