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 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 if ((size % (2 * kPointerSize)) != 0) { | 1369 if ((size % (2 * kPointerSize)) != 0) { |
1370 __ movq(rdx, FieldOperand(rbx, size - kPointerSize)); | 1370 __ movq(rdx, FieldOperand(rbx, size - kPointerSize)); |
1371 __ movq(FieldOperand(rax, size - kPointerSize), rdx); | 1371 __ movq(FieldOperand(rax, size - kPointerSize), rdx); |
1372 } | 1372 } |
1373 context()->Plug(rax); | 1373 context()->Plug(rax); |
1374 } | 1374 } |
1375 | 1375 |
1376 | 1376 |
1377 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { | 1377 void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
1378 Comment cmnt(masm_, "[ ObjectLiteral"); | 1378 Comment cmnt(masm_, "[ ObjectLiteral"); |
| 1379 Handle<FixedArray> constant_properties = expr->constant_properties(); |
1379 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); | 1380 __ movq(rdi, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); |
1380 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); | 1381 __ push(FieldOperand(rdi, JSFunction::kLiteralsOffset)); |
1381 __ Push(Smi::FromInt(expr->literal_index())); | 1382 __ Push(Smi::FromInt(expr->literal_index())); |
1382 __ Push(expr->constant_properties()); | 1383 __ Push(constant_properties); |
1383 int flags = expr->fast_elements() | 1384 int flags = expr->fast_elements() |
1384 ? ObjectLiteral::kFastElements | 1385 ? ObjectLiteral::kFastElements |
1385 : ObjectLiteral::kNoFlags; | 1386 : ObjectLiteral::kNoFlags; |
1386 flags |= expr->has_function() | 1387 flags |= expr->has_function() |
1387 ? ObjectLiteral::kHasFunction | 1388 ? ObjectLiteral::kHasFunction |
1388 : ObjectLiteral::kNoFlags; | 1389 : ObjectLiteral::kNoFlags; |
1389 __ Push(Smi::FromInt(flags)); | 1390 __ Push(Smi::FromInt(flags)); |
| 1391 int properties_count = constant_properties->length() / 2; |
1390 if (expr->depth() > 1) { | 1392 if (expr->depth() > 1) { |
1391 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); | 1393 __ CallRuntime(Runtime::kCreateObjectLiteral, 4); |
| 1394 } else if (flags != ObjectLiteral::kFastElements || |
| 1395 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
| 1396 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); |
1392 } else { | 1397 } else { |
1393 __ CallRuntime(Runtime::kCreateObjectLiteralShallow, 4); | 1398 FastCloneShallowObjectStub stub(properties_count); |
| 1399 __ CallStub(&stub); |
1394 } | 1400 } |
1395 | 1401 |
1396 // If result_saved is true the result is on top of the stack. If | 1402 // If result_saved is true the result is on top of the stack. If |
1397 // result_saved is false the result is in rax. | 1403 // result_saved is false the result is in rax. |
1398 bool result_saved = false; | 1404 bool result_saved = false; |
1399 | 1405 |
1400 // Mark all computed expressions that are bound to a key that | 1406 // Mark all computed expressions that are bound to a key that |
1401 // is shadowed by a later occurrence of the same key. For the | 1407 // is shadowed by a later occurrence of the same key. For the |
1402 // marked expressions, no store code is emitted. | 1408 // marked expressions, no store code is emitted. |
1403 expr->CalculateEmitStore(); | 1409 expr->CalculateEmitStore(); |
(...skipping 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4313 *context_length = 0; | 4319 *context_length = 0; |
4314 return previous_; | 4320 return previous_; |
4315 } | 4321 } |
4316 | 4322 |
4317 | 4323 |
4318 #undef __ | 4324 #undef __ |
4319 | 4325 |
4320 } } // namespace v8::internal | 4326 } } // namespace v8::internal |
4321 | 4327 |
4322 #endif // V8_TARGET_ARCH_X64 | 4328 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |