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

Side by Side Diff: src/arm/fast-codegen-arm.cc

Issue 463041: Push bleeding_edge revision 3429 to trunk to fix new reliability... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 11 years 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 | « no previous file | src/compiler.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 __ b(eq, true_label); 407 __ b(eq, true_label);
408 __ jmp(false_label); 408 __ jmp(false_label);
409 } 409 }
410 410
411 411
412 void FastCodeGenerator::VisitDeclaration(Declaration* decl) { 412 void FastCodeGenerator::VisitDeclaration(Declaration* decl) {
413 Comment cmnt(masm_, "[ Declaration"); 413 Comment cmnt(masm_, "[ Declaration");
414 Variable* var = decl->proxy()->var(); 414 Variable* var = decl->proxy()->var();
415 ASSERT(var != NULL); // Must have been resolved. 415 ASSERT(var != NULL); // Must have been resolved.
416 Slot* slot = var->slot(); 416 Slot* slot = var->slot();
417 ASSERT(slot != NULL); // No global declarations here. 417 Property* prop = var->AsProperty();
418 418
419 // We have 3 cases for slots: LOOKUP, LOCAL, CONTEXT. 419 if (slot != NULL) {
420 switch (slot->type()) { 420 switch (slot->type()) {
421 case Slot::LOOKUP: { 421 case Slot::PARAMETER: // Fall through.
422 __ mov(r2, Operand(var->name())); 422 case Slot::LOCAL:
423 // Declaration nodes are always introduced in one of two modes. 423 if (decl->mode() == Variable::CONST) {
424 ASSERT(decl->mode() == Variable::VAR || decl->mode() == Variable::CONST); 424 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
425 PropertyAttributes attr = decl->mode() == Variable::VAR ? 425 __ str(ip, MemOperand(fp, SlotOffset(var->slot())));
426 NONE : READ_ONLY; 426 } else if (decl->fun() != NULL) {
427 __ mov(r1, Operand(Smi::FromInt(attr))); 427 Visit(decl->fun());
428 // Push initial value, if any. 428 __ pop(ip);
429 // Note: For variables we must not push an initial value (such as 429 __ str(ip, MemOperand(fp, SlotOffset(var->slot())));
430 // 'undefined') because we may have a (legal) redeclaration and we 430 }
431 // must not destroy the current value. 431 break;
432 if (decl->mode() == Variable::CONST) { 432
433 __ mov(r0, Operand(Factory::the_hole_value())); 433 case Slot::CONTEXT:
434 __ stm(db_w, sp, cp.bit() | r2.bit() | r1.bit() | r0.bit()); 434 // The variable in the decl always resides in the current context.
435 } else if (decl->fun() != NULL) { 435 ASSERT_EQ(0, function_->scope()->ContextChainLength(var->scope()));
436 __ stm(db_w, sp, cp.bit() | r2.bit() | r1.bit());
437 Visit(decl->fun()); // Initial value for function decl.
438 } else {
439 __ mov(r0, Operand(Smi::FromInt(0))); // No initial value!
440 __ stm(db_w, sp, cp.bit() | r2.bit() | r1.bit() | r0.bit());
441 }
442 __ CallRuntime(Runtime::kDeclareContextSlot, 4);
443 break;
444 }
445 case Slot::LOCAL:
446 if (decl->mode() == Variable::CONST) {
447 __ mov(r0, Operand(Factory::the_hole_value()));
448 __ str(r0, MemOperand(fp, SlotOffset(var->slot())));
449 } else if (decl->fun() != NULL) {
450 Visit(decl->fun());
451 __ pop(r0);
452 __ str(r0, MemOperand(fp, SlotOffset(var->slot())));
453 }
454 break;
455 case Slot::CONTEXT:
456 // The variable in the decl always resides in the current context.
457 ASSERT(function_->scope()->ContextChainLength(slot->var()->scope()) == 0);
458 if (decl->mode() == Variable::CONST) {
459 __ mov(r0, Operand(Factory::the_hole_value()));
460 if (FLAG_debug_code) { 436 if (FLAG_debug_code) {
461 // Check if we have the correct context pointer. 437 // Check if we have the correct context pointer.
462 __ ldr(r1, CodeGenerator::ContextOperand(cp, 438 __ ldr(r1,
463 Context::FCONTEXT_INDEX)); 439 CodeGenerator::ContextOperand(cp, Context::FCONTEXT_INDEX));
464 __ cmp(r1, cp); 440 __ cmp(r1, cp);
465 __ Check(eq, "Unexpected declaration in current context."); 441 __ Check(eq, "Unexpected declaration in current context.");
466 } 442 }
467 __ str(r0, CodeGenerator::ContextOperand(cp, slot->index())); 443 if (decl->mode() == Variable::CONST) {
468 // No write barrier since the_hole_value is in old space. 444 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
469 ASSERT(!Heap::InNewSpace(*Factory::the_hole_value())); 445 __ str(ip, CodeGenerator::ContextOperand(cp, slot->index()));
470 } else if (decl->fun() != NULL) { 446 // No write barrier since the_hole_value is in old space.
447 } else if (decl->fun() != NULL) {
448 Visit(decl->fun());
449 __ pop(r0);
450 __ str(r0, CodeGenerator::ContextOperand(cp, slot->index()));
451 int offset = Context::SlotOffset(slot->index());
452 __ mov(r2, Operand(offset));
453 // We know that we have written a function, which is not a smi.
454 __ RecordWrite(cp, r2, r0);
455 }
456 break;
457
458 case Slot::LOOKUP: {
459 __ mov(r2, Operand(var->name()));
460 // Declaration nodes are always introduced in one of two modes.
461 ASSERT(decl->mode() == Variable::VAR ||
462 decl->mode() == Variable::CONST);
463 PropertyAttributes attr =
464 (decl->mode() == Variable::VAR) ? NONE : READ_ONLY;
465 __ mov(r1, Operand(Smi::FromInt(attr)));
466 // Push initial value, if any.
467 // Note: For variables we must not push an initial value (such as
468 // 'undefined') because we may have a (legal) redeclaration and we
469 // must not destroy the current value.
470 if (decl->mode() == Variable::CONST) {
471 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex);
472 __ stm(db_w, sp, cp.bit() | r2.bit() | r1.bit() | r0.bit());
473 } else if (decl->fun() != NULL) {
474 __ stm(db_w, sp, cp.bit() | r2.bit() | r1.bit());
475 Visit(decl->fun()); // Initial value for function decl.
476 } else {
477 __ mov(r0, Operand(Smi::FromInt(0))); // No initial value!
478 __ stm(db_w, sp, cp.bit() | r2.bit() | r1.bit() | r0.bit());
479 }
480 __ CallRuntime(Runtime::kDeclareContextSlot, 4);
481 break;
482 }
483 }
484
485 } else if (prop != NULL) {
486 if (decl->fun() != NULL || decl->mode() == Variable::CONST) {
487 // We are declaring a function or constant that rewrites to a
488 // property. Use (keyed) IC to set the initial value.
489 ASSERT_EQ(Expression::kValue, prop->obj()->context());
490 Visit(prop->obj());
491 ASSERT_EQ(Expression::kValue, prop->key()->context());
492 Visit(prop->key());
493
494 if (decl->fun() != NULL) {
495 ASSERT_EQ(Expression::kValue, decl->fun()->context());
471 Visit(decl->fun()); 496 Visit(decl->fun());
472 __ pop(r0); 497 __ pop(r0);
473 if (FLAG_debug_code) { 498 } else {
474 // Check if we have the correct context pointer. 499 __ LoadRoot(r0, Heap::kTheHoleValueRootIndex);
475 __ ldr(r1, CodeGenerator::ContextOperand(cp,
476 Context::FCONTEXT_INDEX));
477 __ cmp(r1, cp);
478 __ Check(eq, "Unexpected declaration in current context.");
479 }
480 __ str(r0, CodeGenerator::ContextOperand(cp, slot->index()));
481 int offset = Context::SlotOffset(slot->index());
482 __ mov(r2, Operand(offset));
483 // We know that we have written a function, which is not a smi.
484 __ RecordWrite(cp, r2, r0);
485 } 500 }
486 break; 501
487 default: 502 Handle<Code> ic(Builtins::builtin(Builtins::KeyedStoreIC_Initialize));
488 UNREACHABLE(); 503 __ Call(ic, RelocInfo::CODE_TARGET);
504
505 // Value in r0 is ignored (declarations are statements). Receiver
506 // and key on stack are discarded.
507 __ add(sp, sp, Operand(2 * kPointerSize));
508 }
489 } 509 }
490 } 510 }
491 511
492 512
493 void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) { 513 void FastCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
494 // Call the runtime to declare the globals. 514 // Call the runtime to declare the globals.
495 // The context is the first argument. 515 // The context is the first argument.
496 __ mov(r1, Operand(pairs)); 516 __ mov(r1, Operand(pairs));
497 __ mov(r0, Operand(Smi::FromInt(is_eval_ ? 1 : 0))); 517 __ mov(r0, Operand(Smi::FromInt(is_eval_ ? 1 : 0)));
498 __ stm(db_w, sp, cp.bit() | r1.bit() | r0.bit()); 518 __ stm(db_w, sp, cp.bit() | r1.bit() | r0.bit());
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1703 true_label_ = saved_true; 1723 true_label_ = saved_true;
1704 false_label_ = saved_false; 1724 false_label_ = saved_false;
1705 // Convert current context to test context: End post-test code. 1725 // Convert current context to test context: End post-test code.
1706 } 1726 }
1707 1727
1708 1728
1709 #undef __ 1729 #undef __
1710 1730
1711 1731
1712 } } // namespace v8::internal 1732 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698