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 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2183 env->deoptimization_index(), | 2183 env->deoptimization_index(), |
2184 true); | 2184 true); |
2185 v8::internal::ParameterCount actual(rax); | 2185 v8::internal::ParameterCount actual(rax); |
2186 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); | 2186 __ InvokeFunction(function, actual, CALL_FUNCTION, &safepoint_generator); |
2187 } | 2187 } |
2188 | 2188 |
2189 | 2189 |
2190 void LCodeGen::DoPushArgument(LPushArgument* instr) { | 2190 void LCodeGen::DoPushArgument(LPushArgument* instr) { |
2191 LOperand* argument = instr->InputAt(0); | 2191 LOperand* argument = instr->InputAt(0); |
2192 if (argument->IsConstantOperand()) { | 2192 if (argument->IsConstantOperand()) { |
2193 LConstantOperand* const_op = LConstantOperand::cast(argument); | 2193 EmitPushConstantOperand(argument); |
2194 Handle<Object> literal = chunk_->LookupLiteral(const_op); | |
2195 Representation r = chunk_->LookupLiteralRepresentation(const_op); | |
2196 if (r.IsInteger32()) { | |
2197 ASSERT(literal->IsNumber()); | |
2198 __ push(Immediate(static_cast<int32_t>(literal->Number()))); | |
2199 } else if (r.IsDouble()) { | |
2200 Abort("unsupported double immediate"); | |
2201 } else { | |
2202 ASSERT(r.IsTagged()); | |
2203 __ Push(literal); | |
2204 } | |
2205 } else if (argument->IsRegister()) { | 2194 } else if (argument->IsRegister()) { |
2206 __ push(ToRegister(argument)); | 2195 __ push(ToRegister(argument)); |
2207 } else { | 2196 } else { |
2208 ASSERT(!argument->IsDoubleRegister()); | 2197 ASSERT(!argument->IsDoubleRegister()); |
2209 __ push(ToOperand(argument)); | 2198 __ push(ToOperand(argument)); |
2210 } | 2199 } |
2211 } | 2200 } |
2212 | 2201 |
2213 | 2202 |
2214 void LCodeGen::DoContext(LContext* instr) { | 2203 void LCodeGen::DoContext(LContext* instr) { |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3236 __ j(not_equal, &check_frame_marker); | 3225 __ j(not_equal, &check_frame_marker); |
3237 __ movq(temp, Operand(rax, StandardFrameConstants::kCallerFPOffset)); | 3226 __ movq(temp, Operand(rax, StandardFrameConstants::kCallerFPOffset)); |
3238 | 3227 |
3239 // Check the marker in the calling frame. | 3228 // Check the marker in the calling frame. |
3240 __ bind(&check_frame_marker); | 3229 __ bind(&check_frame_marker); |
3241 __ SmiCompare(Operand(temp, StandardFrameConstants::kMarkerOffset), | 3230 __ SmiCompare(Operand(temp, StandardFrameConstants::kMarkerOffset), |
3242 Smi::FromInt(StackFrame::CONSTRUCT)); | 3231 Smi::FromInt(StackFrame::CONSTRUCT)); |
3243 } | 3232 } |
3244 | 3233 |
3245 | 3234 |
| 3235 void LCodeGen::EmitPushConstantOperand(LOperand* operand) { |
| 3236 ASSERT(operand->IsConstantOperand()); |
| 3237 LConstantOperand* const_op = LConstantOperand::cast(operand); |
| 3238 Handle<Object> literal = chunk_->LookupLiteral(const_op); |
| 3239 Representation r = chunk_->LookupLiteralRepresentation(const_op); |
| 3240 if (r.IsInteger32()) { |
| 3241 ASSERT(literal->IsNumber()); |
| 3242 __ push(Immediate(static_cast<int32_t>(literal->Number()))); |
| 3243 } else if (r.IsDouble()) { |
| 3244 Abort("unsupported double immediate"); |
| 3245 } else { |
| 3246 ASSERT(r.IsTagged()); |
| 3247 __ Push(literal); |
| 3248 } |
| 3249 } |
| 3250 |
| 3251 |
3246 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { | 3252 void LCodeGen::DoTypeofIsAndBranch(LTypeofIsAndBranch* instr) { |
3247 Register input = ToRegister(instr->InputAt(0)); | 3253 Register input = ToRegister(instr->InputAt(0)); |
3248 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 3254 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
3249 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 3255 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
3250 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 3256 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
3251 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 3257 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
3252 | 3258 |
3253 Condition final_branch_condition = EmitTypeofIs(true_label, | 3259 Condition final_branch_condition = EmitTypeofIs(true_label, |
3254 false_label, | 3260 false_label, |
3255 input, | 3261 input, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3328 // call for populating the safepoint data with deoptimization data. | 3334 // call for populating the safepoint data with deoptimization data. |
3329 } | 3335 } |
3330 | 3336 |
3331 | 3337 |
3332 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { | 3338 void LCodeGen::DoDeoptimize(LDeoptimize* instr) { |
3333 DeoptimizeIf(no_condition, instr->environment()); | 3339 DeoptimizeIf(no_condition, instr->environment()); |
3334 } | 3340 } |
3335 | 3341 |
3336 | 3342 |
3337 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { | 3343 void LCodeGen::DoDeleteProperty(LDeleteProperty* instr) { |
3338 Abort("Unimplemented: %s", "DoDeleteProperty"); | 3344 LOperand* obj = instr->object(); |
| 3345 LOperand* key = instr->key(); |
| 3346 // Push object. |
| 3347 if (obj->IsRegister()) { |
| 3348 __ push(ToRegister(obj)); |
| 3349 } else { |
| 3350 __ push(ToOperand(obj)); |
| 3351 } |
| 3352 // Push key. |
| 3353 if (key->IsConstantOperand()) { |
| 3354 EmitPushConstantOperand(key); |
| 3355 } else if (key->IsRegister()) { |
| 3356 __ push(ToRegister(key)); |
| 3357 } else { |
| 3358 __ push(ToOperand(key)); |
| 3359 } |
| 3360 ASSERT(instr->HasPointerMap() && instr->HasDeoptimizationEnvironment()); |
| 3361 LPointerMap* pointers = instr->pointer_map(); |
| 3362 LEnvironment* env = instr->deoptimization_environment(); |
| 3363 RecordPosition(pointers->position()); |
| 3364 RegisterEnvironmentForDeoptimization(env); |
| 3365 // Create safepoint generator that will also ensure enough space in the |
| 3366 // reloc info for patching in deoptimization (since this is invoking a |
| 3367 // builtin) |
| 3368 SafepointGenerator safepoint_generator(this, |
| 3369 pointers, |
| 3370 env->deoptimization_index(), |
| 3371 true); |
| 3372 __ Push(Smi::FromInt(strict_mode_flag())); |
| 3373 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, &safepoint_generator); |
3339 } | 3374 } |
3340 | 3375 |
3341 | 3376 |
3342 void LCodeGen::DoStackCheck(LStackCheck* instr) { | 3377 void LCodeGen::DoStackCheck(LStackCheck* instr) { |
3343 // Perform stack overflow check. | 3378 // Perform stack overflow check. |
3344 NearLabel done; | 3379 NearLabel done; |
3345 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); | 3380 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); |
3346 __ j(above_equal, &done); | 3381 __ j(above_equal, &done); |
3347 | 3382 |
3348 StackCheckStub stub; | 3383 StackCheckStub stub; |
(...skipping 16 matching lines...) Expand all Loading... |
3365 RegisterEnvironmentForDeoptimization(environment); | 3400 RegisterEnvironmentForDeoptimization(environment); |
3366 ASSERT(osr_pc_offset_ == -1); | 3401 ASSERT(osr_pc_offset_ == -1); |
3367 osr_pc_offset_ = masm()->pc_offset(); | 3402 osr_pc_offset_ = masm()->pc_offset(); |
3368 } | 3403 } |
3369 | 3404 |
3370 #undef __ | 3405 #undef __ |
3371 | 3406 |
3372 } } // namespace v8::internal | 3407 } } // namespace v8::internal |
3373 | 3408 |
3374 #endif // V8_TARGET_ARCH_X64 | 3409 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |