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 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 | 1475 |
1476 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { | 1476 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) { |
1477 // Record position before possible IC call. | 1477 // Record position before possible IC call. |
1478 SetSourcePosition(proxy->position()); | 1478 SetSourcePosition(proxy->position()); |
1479 Variable* var = proxy->var(); | 1479 Variable* var = proxy->var(); |
1480 | 1480 |
1481 // Three cases: global variables, lookup variables, and all other types of | 1481 // Three cases: global variables, lookup variables, and all other types of |
1482 // variables. | 1482 // variables. |
1483 switch (var->location()) { | 1483 switch (var->location()) { |
1484 case Variable::UNALLOCATED: { | 1484 case Variable::UNALLOCATED: { |
1485 Comment cmnt(masm_, "Global variable"); | 1485 Comment cmnt(masm_, "[ Global variable"); |
1486 // Use inline caching. Variable name is passed in r2 and the global | 1486 // Use inline caching. Variable name is passed in r2 and the global |
1487 // object (receiver) in r0. | 1487 // object (receiver) in r0. |
1488 __ ldr(r0, GlobalObjectOperand()); | 1488 __ ldr(r0, GlobalObjectOperand()); |
1489 __ mov(r2, Operand(var->name())); | 1489 __ mov(r2, Operand(var->name())); |
1490 CallLoadIC(CONTEXTUAL); | 1490 CallLoadIC(CONTEXTUAL); |
1491 context()->Plug(r0); | 1491 context()->Plug(r0); |
1492 break; | 1492 break; |
1493 } | 1493 } |
1494 | 1494 |
1495 case Variable::PARAMETER: | 1495 case Variable::PARAMETER: |
1496 case Variable::LOCAL: | 1496 case Variable::LOCAL: |
1497 case Variable::CONTEXT: { | 1497 case Variable::CONTEXT: { |
1498 Comment cmnt(masm_, var->IsContextSlot() | 1498 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
1499 ? "Context variable" | 1499 : "[ Stack variable"); |
1500 : "Stack variable"); | |
1501 if (var->binding_needs_init()) { | 1500 if (var->binding_needs_init()) { |
1502 // var->scope() may be NULL when the proxy is located in eval code and | 1501 // var->scope() may be NULL when the proxy is located in eval code and |
1503 // refers to a potential outside binding. Currently those bindings are | 1502 // refers to a potential outside binding. Currently those bindings are |
1504 // always looked up dynamically, i.e. in that case | 1503 // always looked up dynamically, i.e. in that case |
1505 // var->location() == LOOKUP. | 1504 // var->location() == LOOKUP. |
1506 // always holds. | 1505 // always holds. |
1507 ASSERT(var->scope() != NULL); | 1506 ASSERT(var->scope() != NULL); |
1508 | 1507 |
1509 // Check if the binding really needs an initialization check. The check | 1508 // Check if the binding really needs an initialization check. The check |
1510 // can be skipped in the following situation: we have a LET or CONST | 1509 // can be skipped in the following situation: we have a LET or CONST |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 } | 1552 } |
1554 context()->Plug(r0); | 1553 context()->Plug(r0); |
1555 break; | 1554 break; |
1556 } | 1555 } |
1557 } | 1556 } |
1558 context()->Plug(var); | 1557 context()->Plug(var); |
1559 break; | 1558 break; |
1560 } | 1559 } |
1561 | 1560 |
1562 case Variable::LOOKUP: { | 1561 case Variable::LOOKUP: { |
| 1562 Comment cmnt(masm_, "[ Lookup variable"); |
1563 Label done, slow; | 1563 Label done, slow; |
1564 // Generate code for loading from variables potentially shadowed | 1564 // Generate code for loading from variables potentially shadowed |
1565 // by eval-introduced variables. | 1565 // by eval-introduced variables. |
1566 EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); | 1566 EmitDynamicLookupFastCase(var, NOT_INSIDE_TYPEOF, &slow, &done); |
1567 __ bind(&slow); | 1567 __ bind(&slow); |
1568 Comment cmnt(masm_, "Lookup variable"); | |
1569 __ mov(r1, Operand(var->name())); | 1568 __ mov(r1, Operand(var->name())); |
1570 __ Push(cp, r1); // Context and name. | 1569 __ Push(cp, r1); // Context and name. |
1571 __ CallRuntime(Runtime::kLoadContextSlot, 2); | 1570 __ CallRuntime(Runtime::kLoadContextSlot, 2); |
1572 __ bind(&done); | 1571 __ bind(&done); |
1573 context()->Plug(r0); | 1572 context()->Plug(r0); |
1574 } | 1573 } |
1575 } | 1574 } |
1576 } | 1575 } |
1577 | 1576 |
1578 | 1577 |
(...skipping 2890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4469 } | 4468 } |
4470 } | 4469 } |
4471 } | 4470 } |
4472 | 4471 |
4473 | 4472 |
4474 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 4473 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
4475 ASSERT(!context()->IsEffect()); | 4474 ASSERT(!context()->IsEffect()); |
4476 ASSERT(!context()->IsTest()); | 4475 ASSERT(!context()->IsTest()); |
4477 VariableProxy* proxy = expr->AsVariableProxy(); | 4476 VariableProxy* proxy = expr->AsVariableProxy(); |
4478 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 4477 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
4479 Comment cmnt(masm_, "Global variable"); | 4478 Comment cmnt(masm_, "[ Global variable"); |
4480 __ ldr(r0, GlobalObjectOperand()); | 4479 __ ldr(r0, GlobalObjectOperand()); |
4481 __ mov(r2, Operand(proxy->name())); | 4480 __ mov(r2, Operand(proxy->name())); |
4482 // Use a regular load, not a contextual load, to avoid a reference | 4481 // Use a regular load, not a contextual load, to avoid a reference |
4483 // error. | 4482 // error. |
4484 CallLoadIC(NOT_CONTEXTUAL); | 4483 CallLoadIC(NOT_CONTEXTUAL); |
4485 PrepareForBailout(expr, TOS_REG); | 4484 PrepareForBailout(expr, TOS_REG); |
4486 context()->Plug(r0); | 4485 context()->Plug(r0); |
4487 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 4486 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
| 4487 Comment cmnt(masm_, "[ Lookup slot"); |
4488 Label done, slow; | 4488 Label done, slow; |
4489 | 4489 |
4490 // Generate code for loading from variables potentially shadowed | 4490 // Generate code for loading from variables potentially shadowed |
4491 // by eval-introduced variables. | 4491 // by eval-introduced variables. |
4492 EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); | 4492 EmitDynamicLookupFastCase(proxy->var(), INSIDE_TYPEOF, &slow, &done); |
4493 | 4493 |
4494 __ bind(&slow); | 4494 __ bind(&slow); |
4495 __ mov(r0, Operand(proxy->name())); | 4495 __ mov(r0, Operand(proxy->name())); |
4496 __ Push(cp, r0); | 4496 __ Push(cp, r0); |
4497 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); | 4497 __ CallRuntime(Runtime::kLoadContextSlotNoReferenceError, 2); |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4917 ASSERT(Memory::uint32_at(interrupt_address_pointer) == | 4917 ASSERT(Memory::uint32_at(interrupt_address_pointer) == |
4918 reinterpret_cast<uint32_t>( | 4918 reinterpret_cast<uint32_t>( |
4919 isolate->builtins()->OsrAfterStackCheck()->entry())); | 4919 isolate->builtins()->OsrAfterStackCheck()->entry())); |
4920 return OSR_AFTER_STACK_CHECK; | 4920 return OSR_AFTER_STACK_CHECK; |
4921 } | 4921 } |
4922 | 4922 |
4923 | 4923 |
4924 } } // namespace v8::internal | 4924 } } // namespace v8::internal |
4925 | 4925 |
4926 #endif // V8_TARGET_ARCH_ARM | 4926 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |