OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 ZoneList<Expression*>* args = expr->arguments(); | 2271 ZoneList<Expression*>* args = expr->arguments(); |
2272 int arg_count = args->length(); | 2272 int arg_count = args->length(); |
2273 { PreservePositionScope scope(masm()->positions_recorder()); | 2273 { PreservePositionScope scope(masm()->positions_recorder()); |
2274 for (int i = 0; i < arg_count; i++) { | 2274 for (int i = 0; i < arg_count; i++) { |
2275 VisitForStackValue(args->at(i)); | 2275 VisitForStackValue(args->at(i)); |
2276 } | 2276 } |
2277 } | 2277 } |
2278 // Record source position for debugger. | 2278 // Record source position for debugger. |
2279 SetSourcePosition(expr->position()); | 2279 SetSourcePosition(expr->position()); |
2280 | 2280 |
2281 // Record call targets in unoptimized code, but not in the snapshot. | 2281 // Record call targets in unoptimized code. |
2282 if (!Serializer::enabled()) { | 2282 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); |
2283 flags = static_cast<CallFunctionFlags>(flags | RECORD_CALL_TARGET); | 2283 Handle<Object> uninitialized = |
2284 Handle<Object> uninitialized = | 2284 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2285 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2285 Handle<JSGlobalPropertyCell> cell = |
2286 Handle<JSGlobalPropertyCell> cell = | 2286 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
2287 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | 2287 RecordTypeFeedbackCell(expr->id(), cell); |
2288 RecordTypeFeedbackCell(expr->id(), cell); | 2288 __ Move(rbx, cell); |
2289 __ Move(rbx, cell); | |
2290 } | |
2291 | 2289 |
2292 CallFunctionStub stub(arg_count, flags); | 2290 CallFunctionStub stub(arg_count, flags); |
2293 __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); | 2291 __ movq(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
2294 __ CallStub(&stub, expr->id()); | 2292 __ CallStub(&stub, expr->id()); |
2295 RecordJSReturnSite(expr); | 2293 RecordJSReturnSite(expr); |
2296 // Restore context register. | 2294 // Restore context register. |
2297 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 2295 __ movq(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
2298 // Discard the function left on TOS. | 2296 // Discard the function left on TOS. |
2299 context()->DropAndPlug(1, rax); | 2297 context()->DropAndPlug(1, rax); |
2300 } | 2298 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2459 | 2457 |
2460 // Call the construct call builtin that handles allocation and | 2458 // Call the construct call builtin that handles allocation and |
2461 // constructor invocation. | 2459 // constructor invocation. |
2462 SetSourcePosition(expr->position()); | 2460 SetSourcePosition(expr->position()); |
2463 | 2461 |
2464 // Load function and argument count into rdi and rax. | 2462 // Load function and argument count into rdi and rax. |
2465 __ Set(rax, arg_count); | 2463 __ Set(rax, arg_count); |
2466 __ movq(rdi, Operand(rsp, arg_count * kPointerSize)); | 2464 __ movq(rdi, Operand(rsp, arg_count * kPointerSize)); |
2467 | 2465 |
2468 // Record call targets in unoptimized code, but not in the snapshot. | 2466 // Record call targets in unoptimized code, but not in the snapshot. |
2469 CallFunctionFlags flags; | 2467 Handle<Object> uninitialized = |
2470 if (!Serializer::enabled()) { | 2468 TypeFeedbackCells::UninitializedSentinel(isolate()); |
2471 flags = RECORD_CALL_TARGET; | 2469 Handle<JSGlobalPropertyCell> cell = |
2472 Handle<Object> uninitialized = | 2470 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); |
2473 TypeFeedbackCells::UninitializedSentinel(isolate()); | 2471 RecordTypeFeedbackCell(expr->id(), cell); |
2474 Handle<JSGlobalPropertyCell> cell = | 2472 __ Move(rbx, cell); |
2475 isolate()->factory()->NewJSGlobalPropertyCell(uninitialized); | |
2476 RecordTypeFeedbackCell(expr->id(), cell); | |
2477 __ Move(rbx, cell); | |
2478 } else { | |
2479 flags = NO_CALL_FUNCTION_FLAGS; | |
2480 } | |
2481 | 2473 |
2482 CallConstructStub stub(flags); | 2474 CallConstructStub stub(RECORD_CALL_TARGET); |
2483 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 2475 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
2484 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 2476 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
2485 context()->Plug(rax); | 2477 context()->Plug(rax); |
2486 } | 2478 } |
2487 | 2479 |
2488 | 2480 |
2489 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 2481 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
2490 ZoneList<Expression*>* args = expr->arguments(); | 2482 ZoneList<Expression*>* args = expr->arguments(); |
2491 ASSERT(args->length() == 1); | 2483 ASSERT(args->length() == 1); |
2492 | 2484 |
(...skipping 2051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4544 *context_length = 0; | 4536 *context_length = 0; |
4545 return previous_; | 4537 return previous_; |
4546 } | 4538 } |
4547 | 4539 |
4548 | 4540 |
4549 #undef __ | 4541 #undef __ |
4550 | 4542 |
4551 } } // namespace v8::internal | 4543 } } // namespace v8::internal |
4552 | 4544 |
4553 #endif // V8_TARGET_ARCH_X64 | 4545 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |