| 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_X64 | 7 #if V8_TARGET_ARCH_X64 |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 #endif | 415 #endif |
| 416 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); | 416 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
| 417 __ RecordJSReturn(); | 417 __ RecordJSReturn(); |
| 418 // Do not use the leave instruction here because it is too short to | 418 // Do not use the leave instruction here because it is too short to |
| 419 // patch with the code required by the debugger. | 419 // patch with the code required by the debugger. |
| 420 __ movp(rsp, rbp); | 420 __ movp(rsp, rbp); |
| 421 __ popq(rbp); | 421 __ popq(rbp); |
| 422 int no_frame_start = masm_->pc_offset(); | 422 int no_frame_start = masm_->pc_offset(); |
| 423 | 423 |
| 424 int arg_count = info_->scope()->num_parameters() + 1; | 424 int arg_count = info_->scope()->num_parameters() + 1; |
| 425 if (FLAG_experimental_classes && | 425 if (IsSubclassConstructor(info_->function()->kind())) { |
| 426 IsSubclassConstructor(info_->function()->kind())) { | |
| 427 arg_count++; | 426 arg_count++; |
| 428 } | 427 } |
| 429 int arguments_bytes = arg_count * kPointerSize; | 428 int arguments_bytes = arg_count * kPointerSize; |
| 430 __ Ret(arguments_bytes, rcx); | 429 __ Ret(arguments_bytes, rcx); |
| 431 | 430 |
| 432 // Add padding that will be overwritten by a debugger breakpoint. We | 431 // Add padding that will be overwritten by a debugger breakpoint. We |
| 433 // have just generated at least 7 bytes: "movp rsp, rbp; pop rbp; ret k" | 432 // have just generated at least 7 bytes: "movp rsp, rbp; pop rbp; ret k" |
| 434 // (3 + 1 + 3) for x64 and at least 6 (2 + 1 + 3) bytes for x32. | 433 // (3 + 1 + 3) for x64 and at least 6 (2 + 1 + 3) bytes for x32. |
| 435 const int kPadding = Assembler::kJSReturnSequenceLength - | 434 const int kPadding = Assembler::kJSReturnSequenceLength - |
| 436 kPointerSize == kInt64Size ? 7 : 6; | 435 kPointerSize == kInt64Size ? 7 : 6; |
| (...skipping 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3069 PreservePositionScope scope(masm()->positions_recorder()); | 3068 PreservePositionScope scope(masm()->positions_recorder()); |
| 3070 VisitForStackValue(property->obj()); | 3069 VisitForStackValue(property->obj()); |
| 3071 } | 3070 } |
| 3072 if (is_named_call) { | 3071 if (is_named_call) { |
| 3073 EmitCallWithLoadIC(expr); | 3072 EmitCallWithLoadIC(expr); |
| 3074 } else { | 3073 } else { |
| 3075 EmitKeyedCallWithLoadIC(expr, property->key()); | 3074 EmitKeyedCallWithLoadIC(expr, property->key()); |
| 3076 } | 3075 } |
| 3077 } | 3076 } |
| 3078 } else if (call_type == Call::SUPER_CALL) { | 3077 } else if (call_type == Call::SUPER_CALL) { |
| 3079 if (FLAG_experimental_classes) { | 3078 EmitSuperConstructorCall(expr); |
| 3080 EmitSuperConstructorCall(expr); | |
| 3081 } else { | |
| 3082 EmitLoadSuperConstructor(); | |
| 3083 __ Push(result_register()); | |
| 3084 SuperReference* super_ref = callee->AsSuperReference(); | |
| 3085 VisitForStackValue(super_ref->this_var()); | |
| 3086 EmitCall(expr, CallICState::METHOD); | |
| 3087 } | |
| 3088 } else { | 3079 } else { |
| 3089 DCHECK(call_type == Call::OTHER_CALL); | 3080 DCHECK(call_type == Call::OTHER_CALL); |
| 3090 // Call to an arbitrary expression not handled specially above. | 3081 // Call to an arbitrary expression not handled specially above. |
| 3091 { PreservePositionScope scope(masm()->positions_recorder()); | 3082 { PreservePositionScope scope(masm()->positions_recorder()); |
| 3092 VisitForStackValue(callee); | 3083 VisitForStackValue(callee); |
| 3093 } | 3084 } |
| 3094 __ PushRoot(Heap::kUndefinedValueRootIndex); | 3085 __ PushRoot(Heap::kUndefinedValueRootIndex); |
| 3095 // Emit function call. | 3086 // Emit function call. |
| 3096 EmitCall(expr); | 3087 EmitCall(expr); |
| 3097 } | 3088 } |
| (...skipping 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5375 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5366 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 5376 Assembler::target_address_at(call_target_address, | 5367 Assembler::target_address_at(call_target_address, |
| 5377 unoptimized_code)); | 5368 unoptimized_code)); |
| 5378 return OSR_AFTER_STACK_CHECK; | 5369 return OSR_AFTER_STACK_CHECK; |
| 5379 } | 5370 } |
| 5380 | 5371 |
| 5381 | 5372 |
| 5382 } } // namespace v8::internal | 5373 } } // namespace v8::internal |
| 5383 | 5374 |
| 5384 #endif // V8_TARGET_ARCH_X64 | 5375 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |