| 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 1392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 __ bind(&allocated); | 1403 __ bind(&allocated); |
| 1404 // After this, registers are used as follows: | 1404 // After this, registers are used as follows: |
| 1405 // r0: Newly allocated regexp. | 1405 // r0: Newly allocated regexp. |
| 1406 // r5: Materialized regexp. | 1406 // r5: Materialized regexp. |
| 1407 // r2: temp. | 1407 // r2: temp. |
| 1408 __ CopyFields(r0, r5, r2.bit(), size / kPointerSize); | 1408 __ CopyFields(r0, r5, r2.bit(), size / kPointerSize); |
| 1409 context()->Plug(r0); | 1409 context()->Plug(r0); |
| 1410 } | 1410 } |
| 1411 | 1411 |
| 1412 | 1412 |
| 1413 void FullCodeGenerator::EmitAccessor(Expression* expression) { |
| 1414 if (expression == NULL) { |
| 1415 __ LoadRoot(r1, Heap::kNullValueRootIndex); |
| 1416 __ push(r1); |
| 1417 } else { |
| 1418 VisitForStackValue(expression); |
| 1419 } |
| 1420 } |
| 1421 |
| 1422 |
| 1413 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1423 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
| 1414 Comment cmnt(masm_, "[ ObjectLiteral"); | 1424 Comment cmnt(masm_, "[ ObjectLiteral"); |
| 1415 Handle<FixedArray> constant_properties = expr->constant_properties(); | 1425 Handle<FixedArray> constant_properties = expr->constant_properties(); |
| 1416 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1426 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1417 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1427 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
| 1418 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1428 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
| 1419 __ mov(r1, Operand(constant_properties)); | 1429 __ mov(r1, Operand(constant_properties)); |
| 1420 int flags = expr->fast_elements() | 1430 int flags = expr->fast_elements() |
| 1421 ? ObjectLiteral::kFastElements | 1431 ? ObjectLiteral::kFastElements |
| 1422 : ObjectLiteral::kNoFlags; | 1432 : ObjectLiteral::kNoFlags; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1438 | 1448 |
| 1439 // If result_saved is true the result is on top of the stack. If | 1449 // If result_saved is true the result is on top of the stack. If |
| 1440 // result_saved is false the result is in r0. | 1450 // result_saved is false the result is in r0. |
| 1441 bool result_saved = false; | 1451 bool result_saved = false; |
| 1442 | 1452 |
| 1443 // Mark all computed expressions that are bound to a key that | 1453 // Mark all computed expressions that are bound to a key that |
| 1444 // is shadowed by a later occurrence of the same key. For the | 1454 // is shadowed by a later occurrence of the same key. For the |
| 1445 // marked expressions, no store code is emitted. | 1455 // marked expressions, no store code is emitted. |
| 1446 expr->CalculateEmitStore(); | 1456 expr->CalculateEmitStore(); |
| 1447 | 1457 |
| 1458 AccessorTable accessor_table(isolate()->zone()); |
| 1448 for (int i = 0; i < expr->properties()->length(); i++) { | 1459 for (int i = 0; i < expr->properties()->length(); i++) { |
| 1449 ObjectLiteral::Property* property = expr->properties()->at(i); | 1460 ObjectLiteral::Property* property = expr->properties()->at(i); |
| 1450 if (property->IsCompileTimeValue()) continue; | 1461 if (property->IsCompileTimeValue()) continue; |
| 1451 | 1462 |
| 1452 Literal* key = property->key(); | 1463 Literal* key = property->key(); |
| 1453 Expression* value = property->value(); | 1464 Expression* value = property->value(); |
| 1454 if (!result_saved) { | 1465 if (!result_saved) { |
| 1455 __ push(r0); // Save result on stack | 1466 __ push(r0); // Save result on stack |
| 1456 result_saved = true; | 1467 result_saved = true; |
| 1457 } | 1468 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1486 VisitForStackValue(value); | 1497 VisitForStackValue(value); |
| 1487 if (property->emit_store()) { | 1498 if (property->emit_store()) { |
| 1488 __ mov(r0, Operand(Smi::FromInt(NONE))); // PropertyAttributes | 1499 __ mov(r0, Operand(Smi::FromInt(NONE))); // PropertyAttributes |
| 1489 __ push(r0); | 1500 __ push(r0); |
| 1490 __ CallRuntime(Runtime::kSetProperty, 4); | 1501 __ CallRuntime(Runtime::kSetProperty, 4); |
| 1491 } else { | 1502 } else { |
| 1492 __ Drop(3); | 1503 __ Drop(3); |
| 1493 } | 1504 } |
| 1494 break; | 1505 break; |
| 1495 case ObjectLiteral::Property::GETTER: | 1506 case ObjectLiteral::Property::GETTER: |
| 1507 accessor_table.find(key)->second->getter = value; |
| 1508 break; |
| 1496 case ObjectLiteral::Property::SETTER: | 1509 case ObjectLiteral::Property::SETTER: |
| 1497 // Duplicate receiver on stack. | 1510 accessor_table.find(key)->second->setter = value; |
| 1498 __ ldr(r0, MemOperand(sp)); | |
| 1499 __ push(r0); | |
| 1500 VisitForStackValue(key); | |
| 1501 if (property->kind() == ObjectLiteral::Property::GETTER) { | |
| 1502 VisitForStackValue(value); | |
| 1503 __ LoadRoot(r1, Heap::kNullValueRootIndex); | |
| 1504 __ push(r1); | |
| 1505 } else { | |
| 1506 __ LoadRoot(r1, Heap::kNullValueRootIndex); | |
| 1507 __ push(r1); | |
| 1508 VisitForStackValue(value); | |
| 1509 } | |
| 1510 __ mov(r0, Operand(Smi::FromInt(NONE))); | |
| 1511 __ push(r0); | |
| 1512 __ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5); | |
| 1513 break; | 1511 break; |
| 1514 } | 1512 } |
| 1515 } | 1513 } |
| 1516 | 1514 |
| 1515 // Emit code to define accessors, using only a single call to the runtime for |
| 1516 // each pair of corresponding getters and setters. |
| 1517 for (AccessorTable::Iterator it = accessor_table.begin(); |
| 1518 it != accessor_table.end(); |
| 1519 ++it) { |
| 1520 __ ldr(r0, MemOperand(sp)); // Duplicate receiver. |
| 1521 __ push(r0); |
| 1522 VisitForStackValue(it->first); |
| 1523 EmitAccessor(it->second->getter); |
| 1524 EmitAccessor(it->second->setter); |
| 1525 __ mov(r0, Operand(Smi::FromInt(NONE))); |
| 1526 __ push(r0); |
| 1527 __ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5); |
| 1528 } |
| 1529 |
| 1517 if (expr->has_function()) { | 1530 if (expr->has_function()) { |
| 1518 ASSERT(result_saved); | 1531 ASSERT(result_saved); |
| 1519 __ ldr(r0, MemOperand(sp)); | 1532 __ ldr(r0, MemOperand(sp)); |
| 1520 __ push(r0); | 1533 __ push(r0); |
| 1521 __ CallRuntime(Runtime::kToFastProperties, 1); | 1534 __ CallRuntime(Runtime::kToFastProperties, 1); |
| 1522 } | 1535 } |
| 1523 | 1536 |
| 1524 if (result_saved) { | 1537 if (result_saved) { |
| 1525 context()->PlugTOS(); | 1538 context()->PlugTOS(); |
| 1526 } else { | 1539 } else { |
| (...skipping 2922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4449 *context_length = 0; | 4462 *context_length = 0; |
| 4450 return previous_; | 4463 return previous_; |
| 4451 } | 4464 } |
| 4452 | 4465 |
| 4453 | 4466 |
| 4454 #undef __ | 4467 #undef __ |
| 4455 | 4468 |
| 4456 } } // namespace v8::internal | 4469 } } // namespace v8::internal |
| 4457 | 4470 |
| 4458 #endif // V8_TARGET_ARCH_ARM | 4471 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |