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

Side by Side Diff: src/ia32/full-codegen-ia32.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/ia32/codegen-ia32.cc ('k') | src/ia32/ic-ia32.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 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1319 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1320 Comment cmnt(masm_, "[ ArrayLiteral"); 1320 Comment cmnt(masm_, "[ ArrayLiteral");
1321 1321
1322 ZoneList<Expression*>* subexprs = expr->values(); 1322 ZoneList<Expression*>* subexprs = expr->values();
1323 int length = subexprs->length(); 1323 int length = subexprs->length();
1324 1324
1325 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1325 __ mov(ebx, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1326 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset)); 1326 __ push(FieldOperand(ebx, JSFunction::kLiteralsOffset));
1327 __ push(Immediate(Smi::FromInt(expr->literal_index()))); 1327 __ push(Immediate(Smi::FromInt(expr->literal_index())));
1328 __ push(Immediate(expr->constant_elements())); 1328 __ push(Immediate(expr->constant_elements()));
1329 if (expr->depth() > 1) { 1329 if (expr->constant_elements()->map() == Heap::fixed_cow_array_map()) {
1330 FastCloneShallowArrayStub stub(
1331 FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS, length);
1332 __ CallStub(&stub);
1333 } else if (expr->depth() > 1) {
1330 __ CallRuntime(Runtime::kCreateArrayLiteral, 3); 1334 __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
1331 } else if (length > FastCloneShallowArrayStub::kMaximumLength) { 1335 } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) {
1332 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3); 1336 __ CallRuntime(Runtime::kCreateArrayLiteralShallow, 3);
1333 } else { 1337 } else {
1334 FastCloneShallowArrayStub stub(length); 1338 FastCloneShallowArrayStub stub(
1339 FastCloneShallowArrayStub::CLONE_ELEMENTS, length);
1335 __ CallStub(&stub); 1340 __ CallStub(&stub);
1336 } 1341 }
1337 1342
1338 bool result_saved = false; // Is the result saved to the stack? 1343 bool result_saved = false; // Is the result saved to the stack?
1339 1344
1340 // Emit code to evaluate all the non-constant subexpressions and to store 1345 // Emit code to evaluate all the non-constant subexpressions and to store
1341 // them into the newly cloned array. 1346 // them into the newly cloned array.
1342 for (int i = 0; i < length; i++) { 1347 for (int i = 0; i < length; i++) {
1343 Expression* subexpr = subexprs->at(i); 1348 Expression* subexpr = subexprs->at(i);
1344 // If the subexpression is a literal or a simple materialized literal it 1349 // If the subexpression is a literal or a simple materialized literal it
(...skipping 2008 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 // And return. 3358 // And return.
3354 __ ret(0); 3359 __ ret(0);
3355 } 3360 }
3356 3361
3357 3362
3358 #undef __ 3363 #undef __
3359 3364
3360 } } // namespace v8::internal 3365 } } // namespace v8::internal
3361 3366
3362 #endif // V8_TARGET_ARCH_IA32 3367 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/ia32/ic-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698