| 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 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 | 1483 |
| 1484 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { | 1484 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
| 1485 // Record position before possible IC call. | 1485 // Record position before possible IC call. |
| 1486 SetSourcePosition(proxy->position()); | 1486 SetSourcePosition(proxy->position()); |
| 1487 Variable* var = proxy->var(); | 1487 Variable* var = proxy->var(); |
| 1488 | 1488 |
| 1489 // Three cases: global variables, lookup variables, and all other types of | 1489 // Three cases: global variables, lookup variables, and all other types of |
| 1490 // variables. | 1490 // variables. |
| 1491 switch (var->location()) { | 1491 switch (var->location()) { |
| 1492 case Variable::UNALLOCATED: { | 1492 case Variable::UNALLOCATED: { |
| 1493 Comment cmnt(masm_, "Global variable"); | 1493 Comment cmnt(masm_, "[ Global variable"); |
| 1494 // Use inline caching. Variable name is passed in a2 and the global | 1494 // Use inline caching. Variable name is passed in a2 and the global |
| 1495 // object (receiver) in a0. | 1495 // object (receiver) in a0. |
| 1496 __ lw(a0, GlobalObjectOperand()); | 1496 __ lw(a0, GlobalObjectOperand()); |
| 1497 __ li(a2, Operand(var->name())); | 1497 __ li(a2, Operand(var->name())); |
| 1498 CallLoadIC(CONTEXTUAL); | 1498 CallLoadIC(CONTEXTUAL); |
| 1499 context()->Plug(v0); | 1499 context()->Plug(v0); |
| 1500 break; | 1500 break; |
| 1501 } | 1501 } |
| 1502 | 1502 |
| 1503 case Variable::PARAMETER: | 1503 case Variable::PARAMETER: |
| 1504 case Variable::LOCAL: | 1504 case Variable::LOCAL: |
| 1505 case Variable::CONTEXT: { | 1505 case Variable::CONTEXT: { |
| 1506 Comment cmnt(masm_, var->IsContextSlot() | 1506 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
| 1507 ? "Context variable" | 1507 : "[ Stack variable"); |
| 1508 : "Stack variable"); | |
| 1509 if (var->binding_needs_init()) { | 1508 if (var->binding_needs_init()) { |
| 1510 // var->scope() may be NULL when the proxy is located in eval code and | 1509 // var->scope() may be NULL when the proxy is located in eval code and |
| 1511 // refers to a potential outside binding. Currently those bindings are | 1510 // refers to a potential outside binding. Currently those bindings are |
| 1512 // always looked up dynamically, i.e. in that case | 1511 // always looked up dynamically, i.e. in that case |
| 1513 // var->location() == LOOKUP. | 1512 // var->location() == LOOKUP. |
| 1514 // always holds. | 1513 // always holds. |
| 1515 ASSERT(var->scope() != NULL); | 1514 ASSERT(var->scope() != NULL); |
| 1516 | 1515 |
| 1517 // Check if the binding really needs an initialization check. The check | 1516 // Check if the binding really needs an initialization check. The check |
| 1518 // can be skipped in the following situation: we have a LET or CONST | 1517 // can be skipped in the following situation: we have a LET or CONST |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1563 } | 1562 } |
| 1564 context()->Plug(v0); | 1563 context()->Plug(v0); |
| 1565 break; | 1564 break; |
| 1566 } | 1565 } |
| 1567 } | 1566 } |
| 1568 context()->Plug(var); | 1567 context()->Plug(var); |
| 1569 break; | 1568 break; |
| 1570 } | 1569 } |
| 1571 | 1570 |
| 1572 case Variable::LOOKUP: { | 1571 case Variable::LOOKUP: { |
| 1572 Comment cmnt(masm_, "[ Lookup variable"); |
| 1573 Label done, slow; | 1573 Label done, slow; |
| 1574 // Generate code for loading from variables potentially shadowed | 1574 // Generate code for loading from variables potentially shadowed |
| 1575 // by eval-introduced variables. | 1575 // by eval-introduced variables. |
| 1576 EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); | 1576 EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); |
| 1577 __ bind(&slow); | 1577 __ bind(&slow); |
| 1578 Comment cmnt(masm_, "Lookup variable"); | |
| 1579 __ li(a1, Operand(var->name())); | 1578 __ li(a1, Operand(var->name())); |
| 1580 __ Push(cp, a1); // Context and name. | 1579 __ Push(cp, a1); // Context and name. |
| 1581 __ CallRuntime(Runtime::kLoadContextSlot, 2); | 1580 __ CallRuntime(Runtime::kLoadContextSlot, 2); |
| 1582 __ bind(&done); | 1581 __ bind(&done); |
| 1583 context()->Plug(v0); | 1582 context()->Plug(v0); |
| 1584 } | 1583 } |
| 1585 } | 1584 } |
| 1586 } | 1585 } |
| 1587 | 1586 |
| 1588 | 1587 |
| (...skipping 2942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4531 } | 4530 } |
| 4532 } | 4531 } |
| 4533 } | 4532 } |
| 4534 | 4533 |
| 4535 | 4534 |
| 4536 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 4535 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
| 4537 ASSERT(!context()->IsEffect()); | 4536 ASSERT(!context()->IsEffect()); |
| 4538 ASSERT(!context()->IsTest()); | 4537 ASSERT(!context()->IsTest()); |
| 4539 VariableProxy* proxy = expr->AsVariableProxy(); | 4538 VariableProxy* proxy = expr->AsVariableProxy(); |
| 4540 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4539 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
| 4541 Comment cmnt(masm_, "Global variable"); | 4540 Comment cmnt(masm_, "[ Global variable"); |
| 4542 __ lw(a0, GlobalObjectOperand()); | 4541 __ lw(a0, GlobalObjectOperand()); |
| 4543 __ li(a2, Operand(proxy->name())); | 4542 __ li(a2, Operand(proxy->name())); |
| 4544 // Use a regular load, not a contextual load, to avoid a reference | 4543 // Use a regular load, not a contextual load, to avoid a reference |
| 4545 // error. | 4544 // error. |
| 4546 CallLoadIC(NOT_CONTEXTUAL); | 4545 CallLoadIC(NOT_CONTEXTUAL); |
| 4547 PrepareForBailout(expr, TOS_REG); | 4546 PrepareForBailout(expr, TOS_REG); |
| 4548 context()->Plug(v0); | 4547 context()->Plug(v0); |
| 4549 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4548 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 4549 Comment cmnt(masm_, "[ Lookup slot"); |
| 4550 Label done, slow; | 4550 Label done, slow; |
| 4551 | 4551 |
| 4552 // Generate code for loading from variables potentially shadowed | 4552 // Generate code for loading from variables potentially shadowed |
| 4553 // by eval-introduced variables. | 4553 // by eval-introduced variables. |
| 4554 EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); | 4554 EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); |
| 4555 | 4555 |
| 4556 __ bind(&slow); | 4556 __ bind(&slow); |
| 4557 __ li(a0, Operand(proxy->name())); | 4557 __ li(a0, Operand(proxy->name())); |
| 4558 __ Push(cp, a0); | 4558 __ Push(cp, a0); |
| 4559 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); | 4559 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4968 Assembler::target_address_at(pc_immediate_load_address)) == | 4968 Assembler::target_address_at(pc_immediate_load_address)) == |
| 4969 reinterpret_cast<uint32_t>( | 4969 reinterpret_cast<uint32_t>( |
| 4970 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4970 isolate->builtins()->OsrAfterStackCheck()->entry())); |
| 4971 return OSR_AFTER_STACK_CHECK; | 4971 return OSR_AFTER_STACK_CHECK; |
| 4972 } | 4972 } |
| 4973 | 4973 |
| 4974 | 4974 |
| 4975 } } // namespace v8::internal | 4975 } } // namespace v8::internal |
| 4976 | 4976 |
| 4977 #endif // V8_TARGET_ARCH_MIPS | 4977 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |