Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: src/arm64/full-codegen-arm64.cc

Issue 223823002: Revert r20474 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm64/debug-arm64.cc ('k') | src/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 2319 matching lines...) Expand 10 before | Expand all | Expand 10 after
2330 void FullCodeGenerator::CallIC(Handle<Code> code, 2330 void FullCodeGenerator::CallIC(Handle<Code> code,
2331 TypeFeedbackId ast_id) { 2331 TypeFeedbackId ast_id) {
2332 ic_total_count_++; 2332 ic_total_count_++;
2333 // All calls must have a predictable size in full-codegen code to ensure that 2333 // All calls must have a predictable size in full-codegen code to ensure that
2334 // the debugger can patch them correctly. 2334 // the debugger can patch them correctly.
2335 __ Call(code, RelocInfo::CODE_TARGET, ast_id); 2335 __ Call(code, RelocInfo::CODE_TARGET, ast_id);
2336 } 2336 }
2337 2337
2338 2338
2339 // Code common for calls using the IC. 2339 // Code common for calls using the IC.
2340 void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { 2340 void FullCodeGenerator::EmitCallWithIC(Call* expr) {
2341 ASM_LOCATION("EmitCallWithIC");
2342
2341 Expression* callee = expr->expression(); 2343 Expression* callee = expr->expression();
2344 ZoneList<Expression*>* args = expr->arguments();
2345 int arg_count = args->length();
2342 2346
2343 CallIC::CallType call_type = callee->IsVariableProxy() 2347 CallFunctionFlags flags;
2344 ? CallIC::FUNCTION
2345 : CallIC::METHOD;
2346
2347 // Get the target function. 2348 // Get the target function.
2348 if (call_type == CallIC::FUNCTION) { 2349 if (callee->IsVariableProxy()) {
2349 { StackValueContext context(this); 2350 { StackValueContext context(this);
2350 EmitVariableLoad(callee->AsVariableProxy()); 2351 EmitVariableLoad(callee->AsVariableProxy());
2351 PrepareForBailout(callee, NO_REGISTERS); 2352 PrepareForBailout(callee, NO_REGISTERS);
2352 } 2353 }
2353 // Push undefined as receiver. This is patched in the method prologue if it 2354 // Push undefined as receiver. This is patched in the method prologue if it
2354 // is a sloppy mode method. 2355 // is a sloppy mode method.
2355 __ Push(isolate()->factory()->undefined_value()); 2356 __ Push(isolate()->factory()->undefined_value());
2357 flags = NO_CALL_FUNCTION_FLAGS;
2356 } else { 2358 } else {
2357 // Load the function from the receiver. 2359 // Load the function from the receiver.
2358 ASSERT(callee->IsProperty()); 2360 ASSERT(callee->IsProperty());
2359 __ Peek(x0, 0); 2361 __ Peek(x0, 0);
2360 EmitNamedPropertyLoad(callee->AsProperty()); 2362 EmitNamedPropertyLoad(callee->AsProperty());
2361 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2363 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2362 // Push the target function under the receiver. 2364 // Push the target function under the receiver.
2363 __ Pop(x10); 2365 __ Pop(x10);
2364 __ Push(x0, x10); 2366 __ Push(x0, x10);
2367 flags = CALL_AS_METHOD;
2365 } 2368 }
2366 2369
2367 EmitCall(expr, call_type); 2370 // Load the arguments.
2371 { PreservePositionScope scope(masm()->positions_recorder());
2372 for (int i = 0; i < arg_count; i++) {
2373 VisitForStackValue(args->at(i));
2374 }
2375 }
2376
2377 // Record source position for debugger.
2378 SetSourcePosition(expr->position());
2379 CallFunctionStub stub(arg_count, flags);
2380 __ Peek(x1, (arg_count + 1) * kPointerSize);
2381 __ CallStub(&stub);
2382
2383 RecordJSReturnSite(expr);
2384
2385 // Restore context register.
2386 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2387
2388 context()->DropAndPlug(1, x0);
2368 } 2389 }
2369 2390
2370 2391
2371 // Code common for calls using the IC. 2392 // Code common for calls using the IC.
2372 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, 2393 void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
2373 Expression* key) { 2394 Expression* key) {
2374 // Load the key. 2395 // Load the key.
2375 VisitForAccumulatorValue(key); 2396 VisitForAccumulatorValue(key);
2376 2397
2377 Expression* callee = expr->expression(); 2398 Expression* callee = expr->expression();
2399 ZoneList<Expression*>* args = expr->arguments();
2400 int arg_count = args->length();
2378 2401
2379 // Load the function from the receiver. 2402 // Load the function from the receiver.
2380 ASSERT(callee->IsProperty()); 2403 ASSERT(callee->IsProperty());
2381 __ Peek(x1, 0); 2404 __ Peek(x1, 0);
2382 EmitKeyedPropertyLoad(callee->AsProperty()); 2405 EmitKeyedPropertyLoad(callee->AsProperty());
2383 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2406 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2384 2407
2385 // Push the target function under the receiver. 2408 // Push the target function under the receiver.
2386 __ Pop(x10); 2409 __ Pop(x10);
2387 __ Push(x0, x10); 2410 __ Push(x0, x10);
2388 2411
2389 EmitCall(expr, CallIC::METHOD); 2412 { PreservePositionScope scope(masm()->positions_recorder());
2413 for (int i = 0; i < arg_count; i++) {
2414 VisitForStackValue(args->at(i));
2415 }
2416 }
2417
2418 // Record source position for debugger.
2419 SetSourcePosition(expr->position());
2420 CallFunctionStub stub(arg_count, CALL_AS_METHOD);
2421 __ Peek(x1, (arg_count + 1) * kPointerSize);
2422 __ CallStub(&stub);
2423
2424 RecordJSReturnSite(expr);
2425 // Restore context register.
2426 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2427
2428 context()->DropAndPlug(1, x0);
2390 } 2429 }
2391 2430
2392 2431
2393 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { 2432 void FullCodeGenerator::EmitCallWithStub(Call* expr) {
2394 // Load the arguments. 2433 // Code common for calls using the call stub.
2395 ZoneList<Expression*>* args = expr->arguments(); 2434 ZoneList<Expression*>* args = expr->arguments();
2396 int arg_count = args->length(); 2435 int arg_count = args->length();
2397 { PreservePositionScope scope(masm()->positions_recorder()); 2436 { PreservePositionScope scope(masm()->positions_recorder());
2398 for (int i = 0; i < arg_count; i++) { 2437 for (int i = 0; i < arg_count; i++) {
2399 VisitForStackValue(args->at(i)); 2438 VisitForStackValue(args->at(i));
2400 } 2439 }
2401 } 2440 }
2402 // Record source position of the IC call. 2441 // Record source position for debugger.
2403 SetSourcePosition(expr->position()); 2442 SetSourcePosition(expr->position());
2404 2443
2405 Handle<Code> ic = CallIC::initialize_stub(
2406 isolate(), arg_count, call_type);
2407 Handle<Object> uninitialized = 2444 Handle<Object> uninitialized =
2408 TypeFeedbackInfo::UninitializedSentinel(isolate()); 2445 TypeFeedbackInfo::UninitializedSentinel(isolate());
2409 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized); 2446 StoreFeedbackVectorSlot(expr->CallFeedbackSlot(), uninitialized);
2410 __ LoadObject(x2, FeedbackVector()); 2447 __ LoadObject(x2, FeedbackVector());
2411 __ Mov(x3, Smi::FromInt(expr->CallFeedbackSlot())); 2448 __ Mov(x3, Smi::FromInt(expr->CallFeedbackSlot()));
2449
2450 // Record call targets in unoptimized code.
2451 CallFunctionStub stub(arg_count, RECORD_CALL_TARGET);
2412 __ Peek(x1, (arg_count + 1) * kXRegSize); 2452 __ Peek(x1, (arg_count + 1) * kXRegSize);
2413 // Don't assign a type feedback id to the IC, since type feedback is provided 2453 __ CallStub(&stub);
2414 // by the vector above.
2415 CallIC(ic);
2416
2417 RecordJSReturnSite(expr); 2454 RecordJSReturnSite(expr);
2418 // Restore context register. 2455 // Restore context register.
2419 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2456 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2420 context()->DropAndPlug(1, x0); 2457 context()->DropAndPlug(1, x0);
2421 } 2458 }
2422 2459
2423 2460
2424 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2461 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
2425 ASM_LOCATION("FullCodeGenerator::EmitResolvePossiblyDirectEval"); 2462 ASM_LOCATION("FullCodeGenerator::EmitResolvePossiblyDirectEval");
2426 // Prepare to push a copy of the first argument or undefined if it doesn't 2463 // Prepare to push a copy of the first argument or undefined if it doesn't
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
2498 // Call the evaluated function. 2535 // Call the evaluated function.
2499 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS); 2536 CallFunctionStub stub(arg_count, NO_CALL_FUNCTION_FLAGS);
2500 __ Peek(x1, (arg_count + 1) * kXRegSize); 2537 __ Peek(x1, (arg_count + 1) * kXRegSize);
2501 __ CallStub(&stub); 2538 __ CallStub(&stub);
2502 RecordJSReturnSite(expr); 2539 RecordJSReturnSite(expr);
2503 // Restore context register. 2540 // Restore context register.
2504 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2541 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2505 context()->DropAndPlug(1, x0); 2542 context()->DropAndPlug(1, x0);
2506 2543
2507 } else if (call_type == Call::GLOBAL_CALL) { 2544 } else if (call_type == Call::GLOBAL_CALL) {
2508 EmitCallWithLoadIC(expr); 2545 EmitCallWithIC(expr);
2509 2546
2510 } else if (call_type == Call::LOOKUP_SLOT_CALL) { 2547 } else if (call_type == Call::LOOKUP_SLOT_CALL) {
2511 // Call to a lookup slot (dynamically introduced variable). 2548 // Call to a lookup slot (dynamically introduced variable).
2512 VariableProxy* proxy = callee->AsVariableProxy(); 2549 VariableProxy* proxy = callee->AsVariableProxy();
2513 Label slow, done; 2550 Label slow, done;
2514 2551
2515 { PreservePositionScope scope(masm()->positions_recorder()); 2552 { PreservePositionScope scope(masm()->positions_recorder());
2516 // Generate code for loading from variables potentially shadowed 2553 // Generate code for loading from variables potentially shadowed
2517 // by eval-introduced variables. 2554 // by eval-introduced variables.
2518 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done); 2555 EmitDynamicLookupFastCase(proxy->var(), NOT_INSIDE_TYPEOF, &slow, &done);
(...skipping 19 matching lines...) Expand all
2538 __ Push(x0); 2575 __ Push(x0);
2539 // The receiver is implicitly the global receiver. Indicate this 2576 // The receiver is implicitly the global receiver. Indicate this
2540 // by passing the undefined to the call function stub. 2577 // by passing the undefined to the call function stub.
2541 __ LoadRoot(x1, Heap::kUndefinedValueRootIndex); 2578 __ LoadRoot(x1, Heap::kUndefinedValueRootIndex);
2542 __ Push(x1); 2579 __ Push(x1);
2543 __ Bind(&call); 2580 __ Bind(&call);
2544 } 2581 }
2545 2582
2546 // The receiver is either the global receiver or an object found 2583 // The receiver is either the global receiver or an object found
2547 // by LoadContextSlot. 2584 // by LoadContextSlot.
2548 EmitCall(expr); 2585 EmitCallWithStub(expr);
2549 } else if (call_type == Call::PROPERTY_CALL) { 2586 } else if (call_type == Call::PROPERTY_CALL) {
2550 Property* property = callee->AsProperty(); 2587 Property* property = callee->AsProperty();
2551 { PreservePositionScope scope(masm()->positions_recorder()); 2588 { PreservePositionScope scope(masm()->positions_recorder());
2552 VisitForStackValue(property->obj()); 2589 VisitForStackValue(property->obj());
2553 } 2590 }
2554 if (property->key()->IsPropertyName()) { 2591 if (property->key()->IsPropertyName()) {
2555 EmitCallWithLoadIC(expr); 2592 EmitCallWithIC(expr);
2556 } else { 2593 } else {
2557 EmitKeyedCallWithLoadIC(expr, property->key()); 2594 EmitKeyedCallWithIC(expr, property->key());
2558 } 2595 }
2559 2596
2560 } else { 2597 } else {
2561 ASSERT(call_type == Call::OTHER_CALL); 2598 ASSERT(call_type == Call::OTHER_CALL);
2562 // Call to an arbitrary expression not handled specially above. 2599 // Call to an arbitrary expression not handled specially above.
2563 { PreservePositionScope scope(masm()->positions_recorder()); 2600 { PreservePositionScope scope(masm()->positions_recorder());
2564 VisitForStackValue(callee); 2601 VisitForStackValue(callee);
2565 } 2602 }
2566 __ LoadRoot(x1, Heap::kUndefinedValueRootIndex); 2603 __ LoadRoot(x1, Heap::kUndefinedValueRootIndex);
2567 __ Push(x1); 2604 __ Push(x1);
2568 // Emit function call. 2605 // Emit function call.
2569 EmitCall(expr); 2606 EmitCallWithStub(expr);
2570 } 2607 }
2571 2608
2572 #ifdef DEBUG 2609 #ifdef DEBUG
2573 // RecordJSReturnSite should have been called. 2610 // RecordJSReturnSite should have been called.
2574 ASSERT(expr->return_is_recorded_); 2611 ASSERT(expr->return_is_recorded_);
2575 #endif 2612 #endif
2576 } 2613 }
2577 2614
2578 2615
2579 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 2616 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
(...skipping 29 matching lines...) Expand all
2609 if (FLAG_pretenuring_call_new) { 2646 if (FLAG_pretenuring_call_new) {
2610 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(), 2647 StoreFeedbackVectorSlot(expr->AllocationSiteFeedbackSlot(),
2611 isolate()->factory()->NewAllocationSite()); 2648 isolate()->factory()->NewAllocationSite());
2612 ASSERT(expr->AllocationSiteFeedbackSlot() == 2649 ASSERT(expr->AllocationSiteFeedbackSlot() ==
2613 expr->CallNewFeedbackSlot() + 1); 2650 expr->CallNewFeedbackSlot() + 1);
2614 } 2651 }
2615 2652
2616 __ LoadObject(x2, FeedbackVector()); 2653 __ LoadObject(x2, FeedbackVector());
2617 __ Mov(x3, Smi::FromInt(expr->CallNewFeedbackSlot())); 2654 __ Mov(x3, Smi::FromInt(expr->CallNewFeedbackSlot()));
2618 2655
2619 CallConstructStub stub(RECORD_CONSTRUCTOR_TARGET); 2656 CallConstructStub stub(RECORD_CALL_TARGET);
2620 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); 2657 __ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL);
2621 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2658 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2622 context()->Plug(x0); 2659 context()->Plug(x0);
2623 } 2660 }
2624 2661
2625 2662
2626 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2663 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
2627 ZoneList<Expression*>* args = expr->arguments(); 2664 ZoneList<Expression*>* args = expr->arguments();
2628 ASSERT(args->length() == 1); 2665 ASSERT(args->length() == 1);
2629 2666
(...skipping 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after
4954 return previous_; 4991 return previous_;
4955 } 4992 }
4956 4993
4957 4994
4958 #undef __ 4995 #undef __
4959 4996
4960 4997
4961 } } // namespace v8::internal 4998 } } // namespace v8::internal
4962 4999
4963 #endif // V8_TARGET_ARCH_ARM64 5000 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/debug-arm64.cc ('k') | src/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698