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

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

Issue 181543002: Eliminate extended mode, and other modes clean-up (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/x64/code-stubs-x64.cc ('k') | src/x64/ic-x64.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 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 #ifdef DEBUG 131 #ifdef DEBUG
132 if (strlen(FLAG_stop_at) > 0 && 132 if (strlen(FLAG_stop_at) > 0 &&
133 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) { 133 info->function()->name()->IsUtf8EqualTo(CStrVector(FLAG_stop_at))) {
134 __ int3(); 134 __ int3();
135 } 135 }
136 #endif 136 #endif
137 137
138 // Sloppy mode functions and builtins need to replace the receiver with the 138 // Sloppy mode functions and builtins need to replace the receiver with the
139 // global proxy when called as functions (without an explicit receiver 139 // global proxy when called as functions (without an explicit receiver
140 // object). 140 // object).
141 if (info->is_sloppy_mode() && !info->is_native()) { 141 if (info->strict_mode() == SLOPPY && !info->is_native()) {
142 Label ok; 142 Label ok;
143 // +1 for return address. 143 // +1 for return address.
144 StackArgumentsAccessor args(rsp, info->scope()->num_parameters()); 144 StackArgumentsAccessor args(rsp, info->scope()->num_parameters());
145 __ movp(rcx, args.GetReceiverOperand()); 145 __ movp(rcx, args.GetReceiverOperand());
146 146
147 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex); 147 __ CompareRoot(rcx, Heap::kUndefinedValueRootIndex);
148 __ j(not_equal, &ok, Label::kNear); 148 __ j(not_equal, &ok, Label::kNear);
149 149
150 __ movp(rcx, GlobalObjectOperand()); 150 __ movp(rcx, GlobalObjectOperand());
151 __ movp(rcx, FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset)); 151 __ movp(rcx, FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset));
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 int offset = num_parameters * kPointerSize; 237 int offset = num_parameters * kPointerSize;
238 __ lea(rdx, 238 __ lea(rdx,
239 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset)); 239 Operand(rbp, StandardFrameConstants::kCallerSPOffset + offset));
240 __ push(rdx); 240 __ push(rdx);
241 __ Push(Smi::FromInt(num_parameters)); 241 __ Push(Smi::FromInt(num_parameters));
242 // Arguments to ArgumentsAccessStub: 242 // Arguments to ArgumentsAccessStub:
243 // function, receiver address, parameter count. 243 // function, receiver address, parameter count.
244 // The stub will rewrite receiver and parameter count if the previous 244 // The stub will rewrite receiver and parameter count if the previous
245 // stack frame was an arguments adapter frame. 245 // stack frame was an arguments adapter frame.
246 ArgumentsAccessStub::Type type; 246 ArgumentsAccessStub::Type type;
247 if (!is_sloppy_mode()) { 247 if (strict_mode() == STRICT) {
248 type = ArgumentsAccessStub::NEW_STRICT; 248 type = ArgumentsAccessStub::NEW_STRICT;
249 } else if (function()->has_duplicate_parameters()) { 249 } else if (function()->has_duplicate_parameters()) {
250 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 250 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
251 } else { 251 } else {
252 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 252 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
253 } 253 }
254 ArgumentsAccessStub stub(type); 254 ArgumentsAccessStub stub(type);
255 __ CallStub(&stub); 255 __ CallStub(&stub);
256 256
257 SetVar(arguments, rax, rbx, rdx); 257 SetVar(arguments, rax, rbx, rdx);
(...skipping 10 matching lines...) Expand all
268 scope()->VisitIllegalRedeclaration(this); 268 scope()->VisitIllegalRedeclaration(this);
269 269
270 } else { 270 } else {
271 PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS); 271 PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
272 { Comment cmnt(masm_, "[ Declarations"); 272 { Comment cmnt(masm_, "[ Declarations");
273 // For named function expressions, declare the function name as a 273 // For named function expressions, declare the function name as a
274 // constant. 274 // constant.
275 if (scope()->is_function_scope() && scope()->function() != NULL) { 275 if (scope()->is_function_scope() && scope()->function() != NULL) {
276 VariableDeclaration* function = scope()->function(); 276 VariableDeclaration* function = scope()->function();
277 ASSERT(function->proxy()->var()->mode() == CONST || 277 ASSERT(function->proxy()->var()->mode() == CONST ||
278 function->proxy()->var()->mode() == CONST_HARMONY); 278 function->proxy()->var()->mode() == CONST_LEGACY);
279 ASSERT(function->proxy()->var()->location() != Variable::UNALLOCATED); 279 ASSERT(function->proxy()->var()->location() != Variable::UNALLOCATED);
280 VisitVariableDeclaration(function); 280 VisitVariableDeclaration(function);
281 } 281 }
282 VisitDeclarations(scope()->declarations()); 282 VisitDeclarations(scope()->declarations());
283 } 283 }
284 284
285 { Comment cmnt(masm_, "[ Stack check"); 285 { Comment cmnt(masm_, "[ Stack check");
286 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS); 286 PrepareForBailoutForId(BailoutId::Declarations(), NO_REGISTERS);
287 Label ok; 287 Label ok;
288 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); 288 __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 751
752 752
753 void FullCodeGenerator::VisitVariableDeclaration( 753 void FullCodeGenerator::VisitVariableDeclaration(
754 VariableDeclaration* declaration) { 754 VariableDeclaration* declaration) {
755 // If it was not possible to allocate the variable at compile time, we 755 // If it was not possible to allocate the variable at compile time, we
756 // need to "declare" it at runtime to make sure it actually exists in the 756 // need to "declare" it at runtime to make sure it actually exists in the
757 // local context. 757 // local context.
758 VariableProxy* proxy = declaration->proxy(); 758 VariableProxy* proxy = declaration->proxy();
759 VariableMode mode = declaration->mode(); 759 VariableMode mode = declaration->mode();
760 Variable* variable = proxy->var(); 760 Variable* variable = proxy->var();
761 bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET; 761 bool hole_init = mode == LET || mode == CONST || mode == CONST_LEGACY;
762 switch (variable->location()) { 762 switch (variable->location()) {
763 case Variable::UNALLOCATED: 763 case Variable::UNALLOCATED:
764 globals_->Add(variable->name(), zone()); 764 globals_->Add(variable->name(), zone());
765 globals_->Add(variable->binding_needs_init() 765 globals_->Add(variable->binding_needs_init()
766 ? isolate()->factory()->the_hole_value() 766 ? isolate()->factory()->the_hole_value()
767 : isolate()->factory()->undefined_value(), 767 : isolate()->factory()->undefined_value(),
768 zone()); 768 zone());
769 break; 769 break;
770 770
771 case Variable::PARAMETER: 771 case Variable::PARAMETER:
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1285 // space for nested functions that don't need literals cloning. If 1285 // space for nested functions that don't need literals cloning. If
1286 // we're running with the --always-opt or the --prepare-always-opt 1286 // we're running with the --always-opt or the --prepare-always-opt
1287 // flag, we need to use the runtime function so that the new function 1287 // flag, we need to use the runtime function so that the new function
1288 // we are creating here gets a chance to have its code optimized and 1288 // we are creating here gets a chance to have its code optimized and
1289 // doesn't just get a copy of the existing unoptimized code. 1289 // doesn't just get a copy of the existing unoptimized code.
1290 if (!FLAG_always_opt && 1290 if (!FLAG_always_opt &&
1291 !FLAG_prepare_always_opt && 1291 !FLAG_prepare_always_opt &&
1292 !pretenure && 1292 !pretenure &&
1293 scope()->is_function_scope() && 1293 scope()->is_function_scope() &&
1294 info->num_literals() == 0) { 1294 info->num_literals() == 0) {
1295 FastNewClosureStub stub(info->language_mode(), info->is_generator()); 1295 FastNewClosureStub stub(info->strict_mode(), info->is_generator());
1296 __ Move(rbx, info); 1296 __ Move(rbx, info);
1297 __ CallStub(&stub); 1297 __ CallStub(&stub);
1298 } else { 1298 } else {
1299 __ push(rsi); 1299 __ push(rsi);
1300 __ Push(info); 1300 __ Push(info);
1301 __ Push(pretenure 1301 __ Push(pretenure
1302 ? isolate()->factory()->true_value() 1302 ? isolate()->factory()->true_value()
1303 : isolate()->factory()->false_value()); 1303 : isolate()->factory()->false_value());
1304 __ CallRuntime(Runtime::kNewClosure, 3); 1304 __ CallRuntime(Runtime::kNewClosure, 3);
1305 } 1305 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 // eval-introduced variables. Eval is used a lot without 1411 // eval-introduced variables. Eval is used a lot without
1412 // introducing variables. In those cases, we do not want to 1412 // introducing variables. In those cases, we do not want to
1413 // perform a runtime call for all variables in the scope 1413 // perform a runtime call for all variables in the scope
1414 // containing the eval. 1414 // containing the eval.
1415 if (var->mode() == DYNAMIC_GLOBAL) { 1415 if (var->mode() == DYNAMIC_GLOBAL) {
1416 EmitLoadGlobalCheckExtensions(var, typeof_state, slow); 1416 EmitLoadGlobalCheckExtensions(var, typeof_state, slow);
1417 __ jmp(done); 1417 __ jmp(done);
1418 } else if (var->mode() == DYNAMIC_LOCAL) { 1418 } else if (var->mode() == DYNAMIC_LOCAL) {
1419 Variable* local = var->local_if_not_shadowed(); 1419 Variable* local = var->local_if_not_shadowed();
1420 __ movp(rax, ContextSlotOperandCheckExtensions(local, slow)); 1420 __ movp(rax, ContextSlotOperandCheckExtensions(local, slow));
1421 if (local->mode() == LET || 1421 if (local->mode() == LET || local->mode() == CONST ||
1422 local->mode() == CONST || 1422 local->mode() == CONST_LEGACY) {
1423 local->mode() == CONST_HARMONY) {
1424 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 1423 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
1425 __ j(not_equal, done); 1424 __ j(not_equal, done);
1426 if (local->mode() == CONST) { 1425 if (local->mode() == CONST_LEGACY) {
1427 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 1426 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
1428 } else { // LET || CONST_HARMONY 1427 } else { // LET || CONST
1429 __ Push(var->name()); 1428 __ Push(var->name());
1430 __ CallRuntime(Runtime::kThrowReferenceError, 1); 1429 __ CallRuntime(Runtime::kThrowReferenceError, 1);
1431 } 1430 }
1432 } 1431 }
1433 __ jmp(done); 1432 __ jmp(done);
1434 } 1433 }
1435 } 1434 }
1436 1435
1437 1436
1438 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { 1437 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 // binding is initialized: 1482 // binding is initialized:
1484 // function() { f(); let x = 1; function f() { x = 2; } } 1483 // function() { f(); let x = 1; function f() { x = 2; } }
1485 // 1484 //
1486 bool skip_init_check; 1485 bool skip_init_check;
1487 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { 1486 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
1488 skip_init_check = false; 1487 skip_init_check = false;
1489 } else { 1488 } else {
1490 // Check that we always have valid source position. 1489 // Check that we always have valid source position.
1491 ASSERT(var->initializer_position() != RelocInfo::kNoPosition); 1490 ASSERT(var->initializer_position() != RelocInfo::kNoPosition);
1492 ASSERT(proxy->position() != RelocInfo::kNoPosition); 1491 ASSERT(proxy->position() != RelocInfo::kNoPosition);
1493 skip_init_check = var->mode() != CONST && 1492 skip_init_check = var->mode() != CONST_LEGACY &&
1494 var->initializer_position() < proxy->position(); 1493 var->initializer_position() < proxy->position();
1495 } 1494 }
1496 1495
1497 if (!skip_init_check) { 1496 if (!skip_init_check) {
1498 // Let and const need a read barrier. 1497 // Let and const need a read barrier.
1499 Label done; 1498 Label done;
1500 GetVar(rax, var); 1499 GetVar(rax, var);
1501 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex); 1500 __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
1502 __ j(not_equal, &done, Label::kNear); 1501 __ j(not_equal, &done, Label::kNear);
1503 if (var->mode() == LET || var->mode() == CONST_HARMONY) { 1502 if (var->mode() == LET || var->mode() == CONST) {
1504 // Throw a reference error when using an uninitialized let/const 1503 // Throw a reference error when using an uninitialized let/const
1505 // binding in harmony mode. 1504 // binding in harmony mode.
1506 __ Push(var->name()); 1505 __ Push(var->name());
1507 __ CallRuntime(Runtime::kThrowReferenceError, 1); 1506 __ CallRuntime(Runtime::kThrowReferenceError, 1);
1508 } else { 1507 } else {
1509 // Uninitalized const bindings outside of harmony mode are unholed. 1508 // Uninitalized const bindings outside of harmony mode are unholed.
1510 ASSERT(var->mode() == CONST); 1509 ASSERT(var->mode() == CONST_LEGACY);
1511 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex); 1510 __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
1512 } 1511 }
1513 __ bind(&done); 1512 __ bind(&done);
1514 context()->Plug(rax); 1513 context()->Plug(rax);
1515 break; 1514 break;
1516 } 1515 }
1517 } 1516 }
1518 context()->Plug(var); 1517 context()->Plug(var);
1519 break; 1518 break;
1520 } 1519 }
(...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 CallStoreIC(); 2381 CallStoreIC();
2383 break; 2382 break;
2384 } 2383 }
2385 case KEYED_PROPERTY: { 2384 case KEYED_PROPERTY: {
2386 __ push(rax); // Preserve value. 2385 __ push(rax); // Preserve value.
2387 VisitForStackValue(prop->obj()); 2386 VisitForStackValue(prop->obj());
2388 VisitForAccumulatorValue(prop->key()); 2387 VisitForAccumulatorValue(prop->key());
2389 __ movp(rcx, rax); 2388 __ movp(rcx, rax);
2390 __ pop(rdx); 2389 __ pop(rdx);
2391 __ pop(rax); // Restore value. 2390 __ pop(rax); // Restore value.
2392 Handle<Code> ic = is_sloppy_mode() 2391 Handle<Code> ic = strict_mode() == SLOPPY
2393 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2392 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2394 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2393 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2395 CallIC(ic); 2394 CallIC(ic);
2396 break; 2395 break;
2397 } 2396 }
2398 } 2397 }
2399 context()->Plug(rax); 2398 context()->Plug(rax);
2400 } 2399 }
2401 2400
2402 2401
2403 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot( 2402 void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
2404 Variable* var, MemOperand location) { 2403 Variable* var, MemOperand location) {
2405 __ movp(location, rax); 2404 __ movp(location, rax);
2406 if (var->IsContextSlot()) { 2405 if (var->IsContextSlot()) {
2407 __ movp(rdx, rax); 2406 __ movp(rdx, rax);
2408 __ RecordWriteContextSlot( 2407 __ RecordWriteContextSlot(
2409 rcx, Context::SlotOffset(var->index()), rdx, rbx, kDontSaveFPRegs); 2408 rcx, Context::SlotOffset(var->index()), rdx, rbx, kDontSaveFPRegs);
2410 } 2409 }
2411 } 2410 }
2412 2411
2413 2412
2414 void FullCodeGenerator::EmitCallStoreContextSlot( 2413 void FullCodeGenerator::EmitCallStoreContextSlot(
2415 Handle<String> name, LanguageMode mode) { 2414 Handle<String> name, StrictMode strict_mode) {
2416 __ push(rax); // Value. 2415 __ push(rax); // Value.
2417 __ push(rsi); // Context. 2416 __ push(rsi); // Context.
2418 __ Push(name); 2417 __ Push(name);
2419 __ Push(Smi::FromInt(mode)); 2418 __ Push(Smi::FromInt(strict_mode));
2420 __ CallRuntime(Runtime::kStoreContextSlot, 4); 2419 __ CallRuntime(Runtime::kStoreContextSlot, 4);
2421 } 2420 }
2422 2421
2423 2422
2424 void FullCodeGenerator::EmitVariableAssignment(Variable* var, 2423 void FullCodeGenerator::EmitVariableAssignment(Variable* var,
2425 Token::Value op) { 2424 Token::Value op) {
2426 if (var->IsUnallocated()) { 2425 if (var->IsUnallocated()) {
2427 // Global var, const, or let. 2426 // Global var, const, or let.
2428 __ Move(rcx, var->name()); 2427 __ Move(rcx, var->name());
2429 __ movp(rdx, GlobalObjectOperand()); 2428 __ movp(rdx, GlobalObjectOperand());
2430 CallStoreIC(); 2429 CallStoreIC();
2431 2430
2432 } else if (op == Token::INIT_CONST) { 2431 } else if (op == Token::INIT_CONST_LEGACY) {
2433 // Const initializers need a write barrier. 2432 // Const initializers need a write barrier.
2434 ASSERT(!var->IsParameter()); // No const parameters. 2433 ASSERT(!var->IsParameter()); // No const parameters.
2435 if (var->IsLookupSlot()) { 2434 if (var->IsLookupSlot()) {
2436 __ push(rax); 2435 __ push(rax);
2437 __ push(rsi); 2436 __ push(rsi);
2438 __ Push(var->name()); 2437 __ Push(var->name());
2439 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3); 2438 __ CallRuntime(Runtime::kInitializeConstContextSlot, 3);
2440 } else { 2439 } else {
2441 ASSERT(var->IsStackLocal() || var->IsContextSlot()); 2440 ASSERT(var->IsStackLocal() || var->IsContextSlot());
2442 Label skip; 2441 Label skip;
2443 MemOperand location = VarOperand(var, rcx); 2442 MemOperand location = VarOperand(var, rcx);
2444 __ movp(rdx, location); 2443 __ movp(rdx, location);
2445 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); 2444 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
2446 __ j(not_equal, &skip); 2445 __ j(not_equal, &skip);
2447 EmitStoreToStackLocalOrContextSlot(var, location); 2446 EmitStoreToStackLocalOrContextSlot(var, location);
2448 __ bind(&skip); 2447 __ bind(&skip);
2449 } 2448 }
2450 2449
2451 } else if (var->mode() == LET && op != Token::INIT_LET) { 2450 } else if (var->mode() == LET && op != Token::INIT_LET) {
2452 // Non-initializing assignment to let variable needs a write barrier. 2451 // Non-initializing assignment to let variable needs a write barrier.
2453 if (var->IsLookupSlot()) { 2452 if (var->IsLookupSlot()) {
2454 EmitCallStoreContextSlot(var->name(), language_mode()); 2453 EmitCallStoreContextSlot(var->name(), strict_mode());
2455 } else { 2454 } else {
2456 ASSERT(var->IsStackAllocated() || var->IsContextSlot()); 2455 ASSERT(var->IsStackAllocated() || var->IsContextSlot());
2457 Label assign; 2456 Label assign;
2458 MemOperand location = VarOperand(var, rcx); 2457 MemOperand location = VarOperand(var, rcx);
2459 __ movp(rdx, location); 2458 __ movp(rdx, location);
2460 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); 2459 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
2461 __ j(not_equal, &assign, Label::kNear); 2460 __ j(not_equal, &assign, Label::kNear);
2462 __ Push(var->name()); 2461 __ Push(var->name());
2463 __ CallRuntime(Runtime::kThrowReferenceError, 1); 2462 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2464 __ bind(&assign); 2463 __ bind(&assign);
2465 EmitStoreToStackLocalOrContextSlot(var, location); 2464 EmitStoreToStackLocalOrContextSlot(var, location);
2466 } 2465 }
2467 2466
2468 } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) { 2467 } else if (!var->is_const_mode() || op == Token::INIT_CONST) {
2469 // Assignment to var or initializing assignment to let/const 2468 // Assignment to var or initializing assignment to let/const
2470 // in harmony mode. 2469 // in harmony mode.
2471 if (var->IsLookupSlot()) { 2470 if (var->IsLookupSlot()) {
2472 EmitCallStoreContextSlot(var->name(), language_mode()); 2471 EmitCallStoreContextSlot(var->name(), strict_mode());
2473 } else { 2472 } else {
2474 ASSERT(var->IsStackAllocated() || var->IsContextSlot()); 2473 ASSERT(var->IsStackAllocated() || var->IsContextSlot());
2475 MemOperand location = VarOperand(var, rcx); 2474 MemOperand location = VarOperand(var, rcx);
2476 if (generate_debug_code_ && op == Token::INIT_LET) { 2475 if (generate_debug_code_ && op == Token::INIT_LET) {
2477 // Check for an uninitialized let binding. 2476 // Check for an uninitialized let binding.
2478 __ movp(rdx, location); 2477 __ movp(rdx, location);
2479 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex); 2478 __ CompareRoot(rdx, Heap::kTheHoleValueRootIndex);
2480 __ Check(equal, kLetBindingReInitialization); 2479 __ Check(equal, kLetBindingReInitialization);
2481 } 2480 }
2482 EmitStoreToStackLocalOrContextSlot(var, location); 2481 EmitStoreToStackLocalOrContextSlot(var, location);
(...skipping 20 matching lines...) Expand all
2503 } 2502 }
2504 2503
2505 2504
2506 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { 2505 void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
2507 // Assignment to a property, using a keyed store IC. 2506 // Assignment to a property, using a keyed store IC.
2508 2507
2509 __ pop(rcx); 2508 __ pop(rcx);
2510 __ pop(rdx); 2509 __ pop(rdx);
2511 // Record source code position before IC call. 2510 // Record source code position before IC call.
2512 SetSourcePosition(expr->position()); 2511 SetSourcePosition(expr->position());
2513 Handle<Code> ic = is_sloppy_mode() 2512 Handle<Code> ic = strict_mode() == SLOPPY
2514 ? isolate()->builtins()->KeyedStoreIC_Initialize() 2513 ? isolate()->builtins()->KeyedStoreIC_Initialize()
2515 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 2514 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
2516 CallIC(ic, expr->AssignmentFeedbackId()); 2515 CallIC(ic, expr->AssignmentFeedbackId());
2517 2516
2518 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 2517 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
2519 context()->Plug(rax); 2518 context()->Plug(rax);
2520 } 2519 }
2521 2520
2522 2521
2523 void FullCodeGenerator::VisitProperty(Property* expr) { 2522 void FullCodeGenerator::VisitProperty(Property* expr) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 __ push(Operand(rsp, arg_count * kPointerSize)); 2673 __ push(Operand(rsp, arg_count * kPointerSize));
2675 } else { 2674 } else {
2676 __ PushRoot(Heap::kUndefinedValueRootIndex); 2675 __ PushRoot(Heap::kUndefinedValueRootIndex);
2677 } 2676 }
2678 2677
2679 // Push the receiver of the enclosing function and do runtime call. 2678 // Push the receiver of the enclosing function and do runtime call.
2680 StackArgumentsAccessor args(rbp, info_->scope()->num_parameters()); 2679 StackArgumentsAccessor args(rbp, info_->scope()->num_parameters());
2681 __ push(args.GetReceiverOperand()); 2680 __ push(args.GetReceiverOperand());
2682 2681
2683 // Push the language mode. 2682 // Push the language mode.
2684 __ Push(Smi::FromInt(language_mode())); 2683 __ Push(Smi::FromInt(strict_mode()));
2685 2684
2686 // Push the start position of the scope the calls resides in. 2685 // Push the start position of the scope the calls resides in.
2687 __ Push(Smi::FromInt(scope()->start_position())); 2686 __ Push(Smi::FromInt(scope()->start_position()));
2688 2687
2689 // Do the runtime call. 2688 // Do the runtime call.
2690 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 2689 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5);
2691 } 2690 }
2692 2691
2693 2692
2694 void FullCodeGenerator::VisitCall(Call* expr) { 2693 void FullCodeGenerator::VisitCall(Call* expr) {
(...skipping 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after
4173 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { 4172 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
4174 switch (expr->op()) { 4173 switch (expr->op()) {
4175 case Token::DELETE: { 4174 case Token::DELETE: {
4176 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); 4175 Comment cmnt(masm_, "[ UnaryOperation (DELETE)");
4177 Property* property = expr->expression()->AsProperty(); 4176 Property* property = expr->expression()->AsProperty();
4178 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 4177 VariableProxy* proxy = expr->expression()->AsVariableProxy();
4179 4178
4180 if (property != NULL) { 4179 if (property != NULL) {
4181 VisitForStackValue(property->obj()); 4180 VisitForStackValue(property->obj());
4182 VisitForStackValue(property->key()); 4181 VisitForStackValue(property->key());
4183 StrictModeFlag strict_mode_flag = (language_mode() == SLOPPY_MODE) 4182 __ Push(Smi::FromInt(strict_mode()));
4184 ? kSloppyMode : kStrictMode;
4185 __ Push(Smi::FromInt(strict_mode_flag));
4186 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4183 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4187 context()->Plug(rax); 4184 context()->Plug(rax);
4188 } else if (proxy != NULL) { 4185 } else if (proxy != NULL) {
4189 Variable* var = proxy->var(); 4186 Variable* var = proxy->var();
4190 // Delete of an unqualified identifier is disallowed in strict mode 4187 // Delete of an unqualified identifier is disallowed in strict mode
4191 // but "delete this" is allowed. 4188 // but "delete this" is allowed.
4192 ASSERT(language_mode() == SLOPPY_MODE || var->is_this()); 4189 ASSERT(strict_mode() == SLOPPY || var->is_this());
4193 if (var->IsUnallocated()) { 4190 if (var->IsUnallocated()) {
4194 __ push(GlobalObjectOperand()); 4191 __ push(GlobalObjectOperand());
4195 __ Push(var->name()); 4192 __ Push(var->name());
4196 __ Push(Smi::FromInt(kSloppyMode)); 4193 __ Push(Smi::FromInt(SLOPPY));
4197 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4194 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4198 context()->Plug(rax); 4195 context()->Plug(rax);
4199 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 4196 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
4200 // Result of deleting non-global variables is false. 'this' is 4197 // Result of deleting non-global variables is false. 'this' is
4201 // not really a variable, though we implement it as one. The 4198 // not really a variable, though we implement it as one. The
4202 // subexpression does not have side effects. 4199 // subexpression does not have side effects.
4203 context()->Plug(var->is_this()); 4200 context()->Plug(var->is_this());
4204 } else { 4201 } else {
4205 // Non-global variable. Call the runtime to try to delete from the 4202 // Non-global variable. Call the runtime to try to delete from the
4206 // context where the variable was introduced. 4203 // context where the variable was introduced.
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
4448 context()->PlugTOS(); 4445 context()->PlugTOS();
4449 } 4446 }
4450 } else { 4447 } else {
4451 context()->Plug(rax); 4448 context()->Plug(rax);
4452 } 4449 }
4453 break; 4450 break;
4454 } 4451 }
4455 case KEYED_PROPERTY: { 4452 case KEYED_PROPERTY: {
4456 __ pop(rcx); 4453 __ pop(rcx);
4457 __ pop(rdx); 4454 __ pop(rdx);
4458 Handle<Code> ic = is_sloppy_mode() 4455 Handle<Code> ic = strict_mode() == SLOPPY
4459 ? isolate()->builtins()->KeyedStoreIC_Initialize() 4456 ? isolate()->builtins()->KeyedStoreIC_Initialize()
4460 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); 4457 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
4461 CallIC(ic, expr->CountStoreFeedbackId()); 4458 CallIC(ic, expr->CountStoreFeedbackId());
4462 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); 4459 PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
4463 if (expr->is_postfix()) { 4460 if (expr->is_postfix()) {
4464 if (!context()->IsEffect()) { 4461 if (!context()->IsEffect()) {
4465 context()->PlugTOS(); 4462 context()->PlugTOS();
4466 } 4463 }
4467 } else { 4464 } else {
4468 context()->Plug(rax); 4465 context()->Plug(rax);
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
4907 4904
4908 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4905 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4909 Assembler::target_address_at(call_target_address)); 4906 Assembler::target_address_at(call_target_address));
4910 return OSR_AFTER_STACK_CHECK; 4907 return OSR_AFTER_STACK_CHECK;
4911 } 4908 }
4912 4909
4913 4910
4914 } } // namespace v8::internal 4911 } } // namespace v8::internal
4915 4912
4916 #endif // V8_TARGET_ARCH_X64 4913 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698