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 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 __ push(Immediate(isolate()->factory()->null_value())); | 1520 __ push(Immediate(isolate()->factory()->null_value())); |
1521 } else { | 1521 } else { |
1522 VisitForStackValue(expression); | 1522 VisitForStackValue(expression); |
1523 } | 1523 } |
1524 } | 1524 } |
1525 | 1525 |
1526 | 1526 |
1527 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1527 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1528 Comment cmnt(masm_, "[ ObjectLiteral"); | 1528 Comment cmnt(masm_, "[ ObjectLiteral"); |
1529 Handle<FixedArray> constant_properties = expr->constant_properties(); | 1529 Handle<FixedArray> constant_properties = expr->constant_properties(); |
1530 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); | |
1531 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); | |
1532 __ push(Immediate(Smi::FromInt(expr->literal_index()))); | |
1533 __ push(Immediate(constant_properties)); | |
1534 int flags = expr->fast_elements() | 1530 int flags = expr->fast_elements() |
1535 ? ObjectLiteral::kFastElements | 1531 ? ObjectLiteral::kFastElements |
1536 : ObjectLiteral::kNoFlags; | 1532 : ObjectLiteral::kNoFlags; |
1537 flags |= expr->has_function() | 1533 flags |= expr->has_function() |
1538 ? ObjectLiteral::kHasFunction | 1534 ? ObjectLiteral::kHasFunction |
1539 : ObjectLiteral::kNoFlags; | 1535 : ObjectLiteral::kNoFlags; |
1540 __ push(Immediate(Smi::FromInt(flags))); | |
1541 int properties_count = constant_properties->length() / 2; | 1536 int properties_count = constant_properties->length() / 2; |
1542 if (expr->depth() > 1) { | 1537 if (expr->depth() > 1) { |
| 1538 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1539 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| 1540 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
| 1541 __ push(Immediate(constant_properties)); |
| 1542 __ push(Immediate(Smi::FromInt(flags))); |
1543 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1543 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
1544 } else if (flags != ObjectLiteral::kFastElements || | 1544 } else if (Serializer::enabled() || flags != ObjectLiteral::kFastElements || |
1545 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { | 1545 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1546 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1547 __ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| 1548 __ push(Immediate(Smi::FromInt(expr->literal_index()))); |
| 1549 __ push(Immediate(constant_properties)); |
| 1550 __ push(Immediate(Smi::FromInt(flags))); |
1546 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1551 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1547 } else { | 1552 } else { |
| 1553 __ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1554 __ mov(eax, FieldOperand(edi, JSFunction::kLiteralsOffset)); |
| 1555 __ mov(ebx, Immediate(Smi::FromInt(expr->literal_index()))); |
| 1556 __ mov(ecx, Immediate(constant_properties)); |
| 1557 __ mov(edx, Immediate(Smi::FromInt(flags))); |
1548 FastCloneShallowObjectStub stub(properties_count); | 1558 FastCloneShallowObjectStub stub(properties_count); |
1549 __ CallStub(&stub); | 1559 __ CallStub(&stub); |
1550 } | 1560 } |
1551 | 1561 |
1552 // If result_saved is true the result is on top of the stack. If | 1562 // If result_saved is true the result is on top of the stack. If |
1553 // result_saved is false the result is in eax. | 1563 // result_saved is false the result is in eax. |
1554 bool result_saved = false; | 1564 bool result_saved = false; |
1555 | 1565 |
1556 // Mark all computed expressions that are bound to a key that | 1566 // Mark all computed expressions that are bound to a key that |
1557 // is shadowed by a later occurrence of the same key. For the | 1567 // is shadowed by a later occurrence of the same key. For the |
(...skipping 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4527 *stack_depth = 0; | 4537 *stack_depth = 0; |
4528 *context_length = 0; | 4538 *context_length = 0; |
4529 return previous_; | 4539 return previous_; |
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_IA32 | 4546 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |