OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 // v0: Newly allocated regexp. | 1417 // v0: Newly allocated regexp. |
1418 // t1: Materialized regexp. | 1418 // t1: Materialized regexp. |
1419 // a2: temp. | 1419 // a2: temp. |
1420 __ CopyFields(v0, t1, a2.bit(), size / kPointerSize); | 1420 __ CopyFields(v0, t1, a2.bit(), size / kPointerSize); |
1421 context()->Plug(v0); | 1421 context()->Plug(v0); |
1422 } | 1422 } |
1423 | 1423 |
1424 | 1424 |
1425 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1425 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1426 Comment cmnt(masm_, "[ ObjectLiteral"); | 1426 Comment cmnt(masm_, "[ ObjectLiteral"); |
| 1427 Handle<FixedArray> constant_properties = expr->constant_properties(); |
1427 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1428 __ lw(a3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1428 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); | 1429 __ lw(a3, FieldMemOperand(a3, JSFunction::kLiteralsOffset)); |
1429 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); | 1430 __ li(a2, Operand(Smi::FromInt(expr->literal_index()))); |
1430 __ li(a1, Operand(expr->constant_properties())); | 1431 __ li(a1, Operand(constant_properties)); |
1431 int flags = expr->fast_elements() | 1432 int flags = expr->fast_elements() |
1432 ? ObjectLiteral::kFastElements | 1433 ? ObjectLiteral::kFastElements |
1433 : ObjectLiteral::kNoFlags; | 1434 : ObjectLiteral::kNoFlags; |
1434 flags |= expr->has_function() | 1435 flags |= expr->has_function() |
1435 ? ObjectLiteral::kHasFunction | 1436 ? ObjectLiteral::kHasFunction |
1436 : ObjectLiteral::kNoFlags; | 1437 : ObjectLiteral::kNoFlags; |
1437 __ li(a0, Operand(Smi::FromInt(flags))); | 1438 __ li(a0, Operand(Smi::FromInt(flags))); |
1438 __ Push(a3, a2, a1, a0); | 1439 __ Push(a3, a2, a1, a0); |
| 1440 int properties_count = constant_properties->length() / 2; |
1439 if (expr->depth() > 1) { | 1441 if (expr->depth() > 1) { |
1440 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1442 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
| 1443 } else if (flags != ObjectLiteral::kFastElements || |
| 1444 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1445 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1441 } else { | 1446 } else { |
1442 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1447 FastCloneShallowObjectStub stub(properties_count); |
| 1448 __ CallStub(&stub); |
1443 } | 1449 } |
1444 | 1450 |
1445 // If result_saved is true the result is on top of the stack. If | 1451 // If result_saved is true the result is on top of the stack. If |
1446 // result_saved is false the result is in v0. | 1452 // result_saved is false the result is in v0. |
1447 bool result_saved = false; | 1453 bool result_saved = false; |
1448 | 1454 |
1449 // Mark all computed expressions that are bound to a key that | 1455 // Mark all computed expressions that are bound to a key that |
1450 // is shadowed by a later occurrence of the same key. For the | 1456 // is shadowed by a later occurrence of the same key. For the |
1451 // marked expressions, no store code is emitted. | 1457 // marked expressions, no store code is emitted. |
1452 expr->CalculateEmitStore(); | 1458 expr->CalculateEmitStore(); |
(...skipping 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4438 *context_length = 0; | 4444 *context_length = 0; |
4439 return previous_; | 4445 return previous_; |
4440 } | 4446 } |
4441 | 4447 |
4442 | 4448 |
4443 #undef __ | 4449 #undef __ |
4444 | 4450 |
4445 } } // namespace v8::internal | 4451 } } // namespace v8::internal |
4446 | 4452 |
4447 #endif // V8_TARGET_ARCH_MIPS | 4453 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |