| 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 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
| 8 | 8 |
| 9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
| 10 // | 10 // |
| (...skipping 3128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3139 PreservePositionScope scope(masm()->positions_recorder()); | 3139 PreservePositionScope scope(masm()->positions_recorder()); |
| 3140 VisitForStackValue(property->obj()); | 3140 VisitForStackValue(property->obj()); |
| 3141 } | 3141 } |
| 3142 if (is_named_call) { | 3142 if (is_named_call) { |
| 3143 EmitCallWithLoadIC(expr); | 3143 EmitCallWithLoadIC(expr); |
| 3144 } else { | 3144 } else { |
| 3145 EmitKeyedCallWithLoadIC(expr, property->key()); | 3145 EmitKeyedCallWithLoadIC(expr, property->key()); |
| 3146 } | 3146 } |
| 3147 } | 3147 } |
| 3148 } else if (call_type == Call::SUPER_CALL) { | 3148 } else if (call_type == Call::SUPER_CALL) { |
| 3149 SuperReference* super_ref = callee->AsSuperReference(); | 3149 if (FLAG_experimental_classes) { |
| 3150 EmitLoadSuperConstructor(super_ref); | 3150 EmitSuperConstructorCall(expr); |
| 3151 __ Push(result_register()); | 3151 } else { |
| 3152 VisitForStackValue(super_ref->this_var()); | 3152 SuperReference* super_ref = callee->AsSuperReference(); |
| 3153 EmitCall(expr, CallICState::METHOD); | 3153 EmitLoadSuperConstructor(super_ref); |
| 3154 __ Push(result_register()); |
| 3155 VisitForStackValue(super_ref->this_var()); |
| 3156 EmitCall(expr, CallICState::METHOD); |
| 3157 } |
| 3154 } else { | 3158 } else { |
| 3155 DCHECK(call_type == Call::OTHER_CALL); | 3159 DCHECK(call_type == Call::OTHER_CALL); |
| 3156 // Call to an arbitrary expression not handled specially above. | 3160 // Call to an arbitrary expression not handled specially above. |
| 3157 { PreservePositionScope scope(masm()->positions_recorder()); | 3161 { PreservePositionScope scope(masm()->positions_recorder()); |
| 3158 VisitForStackValue(callee); | 3162 VisitForStackValue(callee); |
| 3159 } | 3163 } |
| 3160 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); | 3164 __ LoadRoot(a1, Heap::kUndefinedValueRootIndex); |
| 3161 __ push(a1); | 3165 __ push(a1); |
| 3162 // Emit function call. | 3166 // Emit function call. |
| 3163 EmitCall(expr); | 3167 EmitCall(expr); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3211 __ li(a2, FeedbackVector()); | 3215 __ li(a2, FeedbackVector()); |
| 3212 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 3216 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
| 3213 | 3217 |
| 3214 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3218 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
| 3215 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3219 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3216 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3220 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
| 3217 context()->Plug(v0); | 3221 context()->Plug(v0); |
| 3218 } | 3222 } |
| 3219 | 3223 |
| 3220 | 3224 |
| 3225 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
| 3226 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
| 3227 EmitLoadSuperConstructor(super_ref); |
| 3228 __ push(result_register()); |
| 3229 |
| 3230 // Push the arguments ("left-to-right") on the stack. |
| 3231 ZoneList<Expression*>* args = expr->arguments(); |
| 3232 int arg_count = args->length(); |
| 3233 for (int i = 0; i < arg_count; i++) { |
| 3234 VisitForStackValue(args->at(i)); |
| 3235 } |
| 3236 |
| 3237 // Call the construct call builtin that handles allocation and |
| 3238 // constructor invocation. |
| 3239 SetSourcePosition(expr->position()); |
| 3240 |
| 3241 // Load function and argument count into a1 and a0. |
| 3242 __ li(a0, Operand(arg_count)); |
| 3243 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); |
| 3244 |
| 3245 // Record call targets in unoptimized code. |
| 3246 if (FLAG_pretenuring_call_new) { |
| 3247 UNREACHABLE(); |
| 3248 /* TODO(dslomov): support pretenuring. |
| 3249 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); |
| 3250 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == |
| 3251 expr->CallNewFeedbackSlot().ToInt() + 1); |
| 3252 */ |
| 3253 } |
| 3254 |
| 3255 __ li(a2, FeedbackVector()); |
| 3256 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); |
| 3257 |
| 3258 // TODO(dslomov): use a different stub and propagate new.target. |
| 3259 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
| 3260 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
| 3261 |
| 3262 RecordJSReturnSite(expr); |
| 3263 |
| 3264 // TODO(dslomov): implement TDZ for `this`. |
| 3265 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN); |
| 3266 context()->Plug(v0); |
| 3267 } |
| 3268 |
| 3269 |
| 3221 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3270 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
| 3222 ZoneList<Expression*>* args = expr->arguments(); | 3271 ZoneList<Expression*>* args = expr->arguments(); |
| 3223 DCHECK(args->length() == 1); | 3272 DCHECK(args->length() == 1); |
| 3224 | 3273 |
| 3225 VisitForAccumulatorValue(args->at(0)); | 3274 VisitForAccumulatorValue(args->at(0)); |
| 3226 | 3275 |
| 3227 Label materialize_true, materialize_false; | 3276 Label materialize_true, materialize_false; |
| 3228 Label* if_true = NULL; | 3277 Label* if_true = NULL; |
| 3229 Label* if_false = NULL; | 3278 Label* if_false = NULL; |
| 3230 Label* fall_through = NULL; | 3279 Label* fall_through = NULL; |
| (...skipping 2068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5299 Assembler::target_address_at(pc_immediate_load_address)) == | 5348 Assembler::target_address_at(pc_immediate_load_address)) == |
| 5300 reinterpret_cast<uint32_t>( | 5349 reinterpret_cast<uint32_t>( |
| 5301 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5350 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 5302 return OSR_AFTER_STACK_CHECK; | 5351 return OSR_AFTER_STACK_CHECK; |
| 5303 } | 5352 } |
| 5304 | 5353 |
| 5305 | 5354 |
| 5306 } } // namespace v8::internal | 5355 } } // namespace v8::internal |
| 5307 | 5356 |
| 5308 #endif // V8_TARGET_ARCH_MIPS | 5357 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |