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

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

Issue 2547433003: [fullcodegen] Remove non-"static" part in VisitArrayLiteral functions. (Closed)
Patch Set: Simplify bailout id in ObjectLiteral. Created 4 years 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/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
6 6
7 // Note on Mips implementation: 7 // Note on Mips implementation:
8 // 8 //
9 // The result_register() for mips is the 'v0' register, which is defined 9 // The result_register() for mips is the 'v0' register, which is defined
10 // by the ABI to contain function return values. However, the first 10 // by the ABI to contain function return values. However, the first
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 __ CallStub(&stub); 1219 __ CallStub(&stub);
1220 RestoreContext(); 1220 RestoreContext();
1221 } 1221 }
1222 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); 1222 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER);
1223 1223
1224 // If result_saved is true the result is on top of the stack. If 1224 // If result_saved is true the result is on top of the stack. If
1225 // result_saved is false the result is in v0. 1225 // result_saved is false the result is in v0.
1226 bool result_saved = false; 1226 bool result_saved = false;
1227 1227
1228 AccessorTable accessor_table(zone()); 1228 AccessorTable accessor_table(zone());
1229 int property_index = 0; 1229 for (int i = 0; i < expr->properties()->length(); i++) {
1230 for (; property_index < expr->properties()->length(); property_index++) { 1230 ObjectLiteral::Property* property = expr->properties()->at(i);
1231 ObjectLiteral::Property* property = expr->properties()->at(property_index); 1231 DCHECK(!property->is_computed_name());
1232 if (property->is_computed_name()) break;
1233 if (property->IsCompileTimeValue()) continue; 1232 if (property->IsCompileTimeValue()) continue;
1234 1233
1235 Literal* key = property->key()->AsLiteral(); 1234 Literal* key = property->key()->AsLiteral();
1236 Expression* value = property->value(); 1235 Expression* value = property->value();
1237 if (!result_saved) { 1236 if (!result_saved) {
1238 PushOperand(v0); // Save result on stack. 1237 PushOperand(v0); // Save result on stack.
1239 result_saved = true; 1238 result_saved = true;
1240 } 1239 }
1241 switch (property->kind()) { 1240 switch (property->kind()) {
1242 case ObjectLiteral::Property::CONSTANT: 1241 case ObjectLiteral::Property::CONSTANT:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 DropOperands(3); 1280 DropOperands(3);
1282 } 1281 }
1283 break; 1282 break;
1284 case ObjectLiteral::Property::PROTOTYPE: 1283 case ObjectLiteral::Property::PROTOTYPE:
1285 // Duplicate receiver on stack. 1284 // Duplicate receiver on stack.
1286 __ ld(a0, MemOperand(sp)); 1285 __ ld(a0, MemOperand(sp));
1287 PushOperand(a0); 1286 PushOperand(a0);
1288 VisitForStackValue(value); 1287 VisitForStackValue(value);
1289 DCHECK(property->emit_store()); 1288 DCHECK(property->emit_store());
1290 CallRuntimeWithOperands(Runtime::kInternalSetPrototype); 1289 CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
1291 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index), 1290 PrepareForBailoutForId(expr->GetIdForPropertySet(i),
1292 BailoutState::NO_REGISTERS); 1291 BailoutState::NO_REGISTERS);
1293 break; 1292 break;
1294 case ObjectLiteral::Property::GETTER: 1293 case ObjectLiteral::Property::GETTER:
1295 if (property->emit_store()) { 1294 if (property->emit_store()) {
1296 AccessorTable::Iterator it = accessor_table.lookup(key); 1295 AccessorTable::Iterator it = accessor_table.lookup(key);
1297 it->second->bailout_id = expr->GetIdForPropertySet(property_index); 1296 it->second->bailout_id = expr->GetIdForPropertySet(i);
1298 it->second->getter = property; 1297 it->second->getter = property;
1299 } 1298 }
1300 break; 1299 break;
1301 case ObjectLiteral::Property::SETTER: 1300 case ObjectLiteral::Property::SETTER:
1302 if (property->emit_store()) { 1301 if (property->emit_store()) {
1303 AccessorTable::Iterator it = accessor_table.lookup(key); 1302 AccessorTable::Iterator it = accessor_table.lookup(key);
1304 it->second->bailout_id = expr->GetIdForPropertySet(property_index); 1303 it->second->bailout_id = expr->GetIdForPropertySet(i);
1305 it->second->setter = property; 1304 it->second->setter = property;
1306 } 1305 }
1307 break; 1306 break;
1308 } 1307 }
1309 } 1308 }
1310 1309
1311 // Emit code to define accessors, using only a single call to the runtime for 1310 // Emit code to define accessors, using only a single call to the runtime for
1312 // each pair of corresponding getters and setters. 1311 // each pair of corresponding getters and setters.
1313 for (AccessorTable::Iterator it = accessor_table.begin(); 1312 for (AccessorTable::Iterator it = accessor_table.begin();
1314 it != accessor_table.end(); 1313 it != accessor_table.end();
1315 ++it) { 1314 ++it) {
1316 __ ld(a0, MemOperand(sp)); // Duplicate receiver. 1315 __ ld(a0, MemOperand(sp)); // Duplicate receiver.
1317 PushOperand(a0); 1316 PushOperand(a0);
1318 VisitForStackValue(it->first); 1317 VisitForStackValue(it->first);
1319 EmitAccessor(it->second->getter); 1318 EmitAccessor(it->second->getter);
1320 EmitAccessor(it->second->setter); 1319 EmitAccessor(it->second->setter);
1321 __ li(a0, Operand(Smi::FromInt(NONE))); 1320 __ li(a0, Operand(Smi::FromInt(NONE)));
1322 PushOperand(a0); 1321 PushOperand(a0);
1323 CallRuntimeWithOperands(Runtime::kDefineAccessorPropertyUnchecked); 1322 CallRuntimeWithOperands(Runtime::kDefineAccessorPropertyUnchecked);
1324 PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS); 1323 PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
1325 } 1324 }
1326 1325
1327 // Object literals have two parts. The "static" part on the left contains no
1328 // computed property names, and so we can compute its map ahead of time; see
1329 // runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
1330 // starts with the first computed property name, and continues with all
1331 // properties to its right. All the code from above initializes the static
1332 // component of the object literal, and arranges for the map of the result to
1333 // reflect the static order in which the keys appear. For the dynamic
1334 // properties, we compile them into a series of "SetOwnProperty" runtime
1335 // calls. This will preserve insertion order.
1336 for (; property_index < expr->properties()->length(); property_index++) {
1337 ObjectLiteral::Property* property = expr->properties()->at(property_index);
1338
1339 Expression* value = property->value();
1340 if (!result_saved) {
1341 PushOperand(v0); // Save result on the stack
1342 result_saved = true;
1343 }
1344
1345 __ ld(a0, MemOperand(sp)); // Duplicate receiver.
1346 PushOperand(a0);
1347
1348 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
1349 DCHECK(!property->is_computed_name());
1350 VisitForStackValue(value);
1351 DCHECK(property->emit_store());
1352 CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
1353 PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
1354 BailoutState::NO_REGISTERS);
1355 } else {
1356 EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
1357 VisitForStackValue(value);
1358 if (NeedsHomeObject(value)) {
1359 EmitSetHomeObject(value, 2, property->GetSlot());
1360 }
1361
1362 switch (property->kind()) {
1363 case ObjectLiteral::Property::CONSTANT:
1364 case ObjectLiteral::Property::MATERIALIZED_LITERAL:
1365 case ObjectLiteral::Property::COMPUTED:
1366 case ObjectLiteral::Property::PROTOTYPE:
1367 UNREACHABLE();
1368 break;
1369
1370 case ObjectLiteral::Property::GETTER:
1371 PushOperand(Smi::FromInt(NONE));
1372 CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
1373 break;
1374
1375 case ObjectLiteral::Property::SETTER:
1376 PushOperand(Smi::FromInt(NONE));
1377 CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
1378 break;
1379 }
1380 }
1381 }
1382
1383 if (result_saved) { 1326 if (result_saved) {
1384 context()->PlugTOS(); 1327 context()->PlugTOS();
1385 } else { 1328 } else {
1386 context()->Plug(v0); 1329 context()->Plug(v0);
1387 } 1330 }
1388 } 1331 }
1389 1332
1390 1333
1391 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) { 1334 void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
1392 Comment cmnt(masm_, "[ ArrayLiteral"); 1335 Comment cmnt(masm_, "[ ArrayLiteral");
(...skipping 1765 matching lines...) Expand 10 before | Expand all | Expand 10 after
3158 reinterpret_cast<uint64_t>( 3101 reinterpret_cast<uint64_t>(
3159 isolate->builtins()->OnStackReplacement()->entry())); 3102 isolate->builtins()->OnStackReplacement()->entry()));
3160 return ON_STACK_REPLACEMENT; 3103 return ON_STACK_REPLACEMENT;
3161 } 3104 }
3162 3105
3163 3106
3164 } // namespace internal 3107 } // namespace internal
3165 } // namespace v8 3108 } // namespace v8
3166 3109
3167 #endif // V8_TARGET_ARCH_MIPS64 3110 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/full-codegen/mips/full-codegen-mips.cc ('k') | src/full-codegen/ppc/full-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698