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