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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1409 // r0: Newly allocated regexp. | 1409 // r0: Newly allocated regexp. |
1410 // r5: Materialized regexp. | 1410 // r5: Materialized regexp. |
1411 // r2: temp. | 1411 // r2: temp. |
1412 __ CopyFields(r0, r5, r2.bit(), size / kPointerSize); | 1412 __ CopyFields(r0, r5, r2.bit(), size / kPointerSize); |
1413 context()->Plug(r0); | 1413 context()->Plug(r0); |
1414 } | 1414 } |
1415 | 1415 |
1416 | 1416 |
1417 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1417 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1418 Comment cmnt(masm_, "[ ObjectLiteral"); | 1418 Comment cmnt(masm_, "[ ObjectLiteral"); |
| 1419 Handle<FixedArray> constant_properties = expr->constant_properties(); |
1419 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1420 __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1420 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); | 1421 __ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset)); |
1421 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); | 1422 __ mov(r2, Operand(Smi::FromInt(expr->literal_index()))); |
1422 __ mov(r1, Operand(expr->constant_properties())); | 1423 __ mov(r1, Operand(constant_properties)); |
1423 int flags = expr->fast_elements() | 1424 int flags = expr->fast_elements() |
1424 ? ObjectLiteral::kFastElements | 1425 ? ObjectLiteral::kFastElements |
1425 : ObjectLiteral::kNoFlags; | 1426 : ObjectLiteral::kNoFlags; |
1426 flags |= expr->has_function() | 1427 flags |= expr->has_function() |
1427 ? ObjectLiteral::kHasFunction | 1428 ? ObjectLiteral::kHasFunction |
1428 : ObjectLiteral::kNoFlags; | 1429 : ObjectLiteral::kNoFlags; |
1429 __ mov(r0, Operand(Smi::FromInt(flags))); | 1430 __ mov(r0, Operand(Smi::FromInt(flags))); |
1430 __ Push(r3, r2, r1, r0); | 1431 __ Push(r3, r2, r1, r0); |
| 1432 int properties_count = constant_properties->length() / 2; |
1431 if (expr->depth() > 1) { | 1433 if (expr->depth() > 1) { |
1432 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1434 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
| 1435 } else if (flags != ObjectLiteral::kFastElements || |
| 1436 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1437 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1433 } else { | 1438 } else { |
1434 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1439 FastCloneShallowObjectStub stub(properties_count); |
| 1440 __ CallStub(&stub); |
1435 } | 1441 } |
1436 | 1442 |
1437 // If result_saved is true the result is on top of the stack. If | 1443 // If result_saved is true the result is on top of the stack. If |
1438 // result_saved is false the result is in r0. | 1444 // result_saved is false the result is in r0. |
1439 bool result_saved = false; | 1445 bool result_saved = false; |
1440 | 1446 |
1441 // Mark all computed expressions that are bound to a key that | 1447 // Mark all computed expressions that are bound to a key that |
1442 // is shadowed by a later occurrence of the same key. For the | 1448 // is shadowed by a later occurrence of the same key. For the |
1443 // marked expressions, no store code is emitted. | 1449 // marked expressions, no store code is emitted. |
1444 expr->CalculateEmitStore(); | 1450 expr->CalculateEmitStore(); |
(...skipping 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4357 *context_length = 0; | 4363 *context_length = 0; |
4358 return previous_; | 4364 return previous_; |
4359 } | 4365 } |
4360 | 4366 |
4361 | 4367 |
4362 #undef __ | 4368 #undef __ |
4363 | 4369 |
4364 } } // namespace v8::internal | 4370 } } // namespace v8::internal |
4365 | 4371 |
4366 #endif // V8_TARGET_ARCH_ARM | 4372 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |