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 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 __ PushRoot(Heap::kNullValueRootIndex); | 1544 __ PushRoot(Heap::kNullValueRootIndex); |
1545 } else { | 1545 } else { |
1546 VisitForStackValue(expression); | 1546 VisitForStackValue(expression); |
1547 } | 1547 } |
1548 } | 1548 } |
1549 | 1549 |
1550 | 1550 |
1551 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1551 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1552 Comment cmnt(masm_, "[ ObjectLiteral"); | 1552 Comment cmnt(masm_, "[ ObjectLiteral"); |
1553 Handle<FixedArray> constant_properties = expr->constant_properties(); | 1553 Handle<FixedArray> constant_properties = expr->constant_properties(); |
1554 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | |
1555 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); | |
1556 __ Push(Smi::FromInt(expr->literal_index())); | |
1557 __ Push(constant_properties); | |
1558 int flags = expr->fast_elements() | 1554 int flags = expr->fast_elements() |
1559 ? ObjectLiteral::kFastElements | 1555 ? ObjectLiteral::kFastElements |
1560 : ObjectLiteral::kNoFlags; | 1556 : ObjectLiteral::kNoFlags; |
1561 flags |= expr->has_function() | 1557 flags |= expr->has_function() |
1562 ? ObjectLiteral::kHasFunction | 1558 ? ObjectLiteral::kHasFunction |
1563 : ObjectLiteral::kNoFlags; | 1559 : ObjectLiteral::kNoFlags; |
1564 __ Push(Smi::FromInt(flags)); | |
1565 int properties_count = constant_properties->length() / 2; | 1560 int properties_count = constant_properties->length() / 2; |
1566 if (expr->depth() > 1) { | 1561 if (expr->depth() > 1) { |
| 1562 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1563 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); |
| 1564 __ Push(Smi::FromInt(expr->literal_index())); |
| 1565 __ Push(constant_properties); |
| 1566 __ Push(Smi::FromInt(flags)); |
1567 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1567 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1568 } else if (flags != ObjectLiteral::kFastElements || | 1568 } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements || |
1569 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 1569 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1570 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1571 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); |
| 1572 __ Push(Smi::FromInt(expr->literal_index())); |
| 1573 __ Push(constant_properties); |
| 1574 __ Push(Smi::FromInt(flags)); |
1570 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1575 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1571 } else { | 1576 } else { |
| 1577 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1578 __ movq(rax, FieldOperand(rdi, JSFunction::kLiteralsOffset)); |
| 1579 __ Move(rbx, Smi::FromInt(expr->literal_index())); |
| 1580 __ Move(rcx, constant_properties); |
| 1581 __ Move(rdx, Smi::FromInt(flags)); |
1572 FastCloneShallowObjectStub stub(properties_count); | 1582 FastCloneShallowObjectStub stub(properties_count); |
1573 __ CallStub(&stub); | 1583 __ CallStub(&stub); |
1574 } | 1584 } |
1575 | 1585 |
1576 // If result_saved is true the result is on top of the stack. If | 1586 // If result_saved is true the result is on top of the stack. If |
1577 // result_saved is false the result is in rax. | 1587 // result_saved is false the result is in rax. |
1578 bool result_saved = false; | 1588 bool result_saved = false; |
1579 | 1589 |
1580 // Mark all computed expressions that are bound to a key that | 1590 // Mark all computed expressions that are bound to a key that |
1581 // is shadowed by a later occurrence of the same key. For the | 1591 // is shadowed by a later occurrence of the same key. For the |
(...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4526 *context_length = 0; | 4536 *context_length = 0; |
4527 return previous_; | 4537 return previous_; |
4528 } | 4538 } |
4529 | 4539 |
4530 | 4540 |
4531 #undef __ | 4541 #undef __ |
4532 | 4542 |
4533 } } // namespace v8::internal | 4543 } } // namespace v8::internal |
4534 | 4544 |
4535 #endif // V8_TARGET_ARCH_X64 | 4545 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |