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

Side by Side Diff: src/interpreter/bytecode-array-builder.cc

Issue 1524803003: [Interpreter] Add support for Load / Store to Lookup slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@init_eval_impl
Patch Set: Fixed nits. Created 5 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/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #include "src/interpreter/bytecode-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 if (FitsInIdx8Operand(slot_index)) { 431 if (FitsInIdx8Operand(slot_index)) {
432 Output(Bytecode::kStaContextSlot, context.ToOperand(), 432 Output(Bytecode::kStaContextSlot, context.ToOperand(),
433 static_cast<uint8_t>(slot_index)); 433 static_cast<uint8_t>(slot_index));
434 } else { 434 } else {
435 UNIMPLEMENTED(); 435 UNIMPLEMENTED();
436 } 436 }
437 return *this; 437 return *this;
438 } 438 }
439 439
440 440
441 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLookupSlot(
442 const Handle<String> name, TypeofMode typeof_mode) {
443 Bytecode bytecode = (typeof_mode == INSIDE_TYPEOF)
444 ? Bytecode::kLdaLookupSlotInsideTypeof
445 : Bytecode::kLdaLookupSlot;
446 size_t name_index = GetConstantPoolEntry(name);
447 if (FitsInIdx8Operand(name_index)) {
448 Output(bytecode, static_cast<uint8_t>(name_index));
449 } else {
450 UNIMPLEMENTED();
451 }
452 return *this;
453 }
454
455
456 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreLookupSlot(
457 const Handle<String> name, LanguageMode language_mode) {
458 Bytecode bytecode = BytecodeForStoreLookupSlot(language_mode);
459 size_t name_index = GetConstantPoolEntry(name);
460 if (FitsInIdx8Operand(name_index)) {
461 Output(bytecode, static_cast<uint8_t>(name_index));
462 } else {
463 UNIMPLEMENTED();
464 }
465 return *this;
466 }
467
468
441 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( 469 BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
442 Register object, size_t name_index, int feedback_slot, 470 Register object, size_t name_index, int feedback_slot,
443 LanguageMode language_mode) { 471 LanguageMode language_mode) {
444 Bytecode bytecode = BytecodeForLoadIC(language_mode); 472 Bytecode bytecode = BytecodeForLoadIC(language_mode);
445 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { 473 if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
446 Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index), 474 Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index),
447 static_cast<uint8_t>(feedback_slot)); 475 static_cast<uint8_t>(feedback_slot));
448 } else if (FitsInIdx16Operand(name_index) && 476 } else if (FitsInIdx16Operand(name_index) &&
449 FitsInIdx16Operand(feedback_slot)) { 477 FitsInIdx16Operand(feedback_slot)) {
450 Output(BytecodeForWideOperands(bytecode), object.ToOperand(), 478 Output(BytecodeForWideOperands(bytecode), object.ToOperand(),
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 case STRONG: 1344 case STRONG:
1317 UNIMPLEMENTED(); 1345 UNIMPLEMENTED();
1318 default: 1346 default:
1319 UNREACHABLE(); 1347 UNREACHABLE();
1320 } 1348 }
1321 return static_cast<Bytecode>(-1); 1349 return static_cast<Bytecode>(-1);
1322 } 1350 }
1323 1351
1324 1352
1325 // static 1353 // static
1354 Bytecode BytecodeArrayBuilder::BytecodeForStoreLookupSlot(
1355 LanguageMode language_mode) {
1356 switch (language_mode) {
1357 case SLOPPY:
1358 return Bytecode::kStaLookupSlotSloppy;
1359 case STRICT:
1360 return Bytecode::kStaLookupSlotStrict;
1361 case STRONG:
1362 UNIMPLEMENTED();
1363 default:
1364 UNREACHABLE();
1365 }
1366 return static_cast<Bytecode>(-1);
1367 }
1368
1369
1370 // static
1326 Bytecode BytecodeArrayBuilder::BytecodeForCreateArguments( 1371 Bytecode BytecodeArrayBuilder::BytecodeForCreateArguments(
1327 CreateArgumentsType type) { 1372 CreateArgumentsType type) {
1328 switch (type) { 1373 switch (type) {
1329 case CreateArgumentsType::kMappedArguments: 1374 case CreateArgumentsType::kMappedArguments:
1330 return Bytecode::kCreateMappedArguments; 1375 return Bytecode::kCreateMappedArguments;
1331 case CreateArgumentsType::kUnmappedArguments: 1376 case CreateArgumentsType::kUnmappedArguments:
1332 return Bytecode::kCreateUnmappedArguments; 1377 return Bytecode::kCreateUnmappedArguments;
1333 default: 1378 default:
1334 UNREACHABLE(); 1379 UNREACHABLE();
1335 } 1380 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 DCHECK_GT(next_consecutive_count_, 0); 1473 DCHECK_GT(next_consecutive_count_, 0);
1429 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); 1474 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
1430 allocated_.push_back(next_consecutive_register_); 1475 allocated_.push_back(next_consecutive_register_);
1431 next_consecutive_count_--; 1476 next_consecutive_count_--;
1432 return Register(next_consecutive_register_++); 1477 return Register(next_consecutive_register_++);
1433 } 1478 }
1434 1479
1435 } // namespace interpreter 1480 } // namespace interpreter
1436 } // namespace internal 1481 } // namespace internal
1437 } // namespace v8 1482 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698