Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 3144002: Copy-on-write arrays. (Closed)
Patch Set: Review fixes. Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1323 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1324 Comment cmnt(masm_, "[ ArrayLiteral"); 1324 Comment cmnt(masm_, "[ ArrayLiteral");
1325 1325
1326 ZoneList<Expression*>* subexprs = expr->values(); 1326 ZoneList<Expression*>* subexprs = expr->values();
1327 int length = subexprs->length(); 1327 int length = subexprs->length();
1328 1328
1329 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset)); 1329 __ movq(rbx, Operand(rbp, JavaScriptFrameConstants::kFunctionOffset));
1330 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset)); 1330 __ push(FieldOperand(rbx, JSFunction::kLiteralsOffset));
1331 __ Push(Smi::FromInt(expr->literal_index())); 1331 __ Push(Smi::FromInt(expr->literal_index()));
1332 __ Push(expr->constant_elements()); 1332 __ Push(expr->constant_elements());
1333 if (expr->depth() > 1) { 1333 if (expr->constant_elements()->map() == Heap::fixed_cow_array_map()) {
1334 FastCloneShallowArrayStub stub(
1335 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
1336 __ CallStub(&stub);
1337 } else if (expr->depth() > 1) {
1334 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1338 __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
1335 } else if (length > FastCloneShallowArrayStub::kMaximumLength) { 1339 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1336 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); 1340 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3);
1337 } else { 1341 } else {
1338 FastCloneShallowArrayStub stub(length); 1342 FastCloneShallowArrayStub stub(
1343 FastCloneShallowArrayStub::CLONE_ELEMENTS, length);
1339 __ CallStub(&stub); 1344 __ CallStub(&stub);
1340 } 1345 }
1341 1346
1342 bool result_saved = false; // Is the result saved to the stack? 1347 bool result_saved = false; // Is the result saved to the stack?
1343 1348
1344 // Emit code to evaluate all the non-constant subexpressions and to store 1349 // Emit code to evaluate all the non-constant subexpressions and to store
1345 // them into the newly cloned array. 1350 // them into the newly cloned array.
1346 for (int i = 0; i < length; i++) { 1351 for (int i = 0; i < length; i++) {
1347 Expression* subexpr = subexprs->at(i); 1352 Expression* subexpr = subexprs->at(i);
1348 // If the subexpression is a literal or a simple materialized literal it 1353 // If the subexpression is a literal or a simple materialized literal it
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after
3344 __ ret(0); 3349 __ ret(0);
3345 } 3350 }
3346 3351
3347 3352
3348 #undef __ 3353 #undef __
3349 3354
3350 3355
3351 } } // namespace v8::internal 3356 } } // namespace v8::internal
3352 3357
3353 #endif // V8_TARGET_ARCH_X64 3358 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698