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

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

Issue 1412953007: [Interpreter] Fill out function prologue support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased Created 5 years, 2 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/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 382
383 383
384 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateClosure( 384 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateClosure(
385 PretenureFlag tenured) { 385 PretenureFlag tenured) {
386 DCHECK(FitsInImm8Operand(tenured)); 386 DCHECK(FitsInImm8Operand(tenured));
387 Output(Bytecode::kCreateClosure, static_cast<uint8_t>(tenured)); 387 Output(Bytecode::kCreateClosure, static_cast<uint8_t>(tenured));
388 return *this; 388 return *this;
389 } 389 }
390 390
391 391
392 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArguments(
393 CreateArgumentsType type) {
394 // TODO(rmcilroy): Consider passing the type as a bytecode operand rather
395 // than having two different bytecodes once we have better support for
396 // branches in the InterpreterAssembler.
397 Bytecode bytecode = BytecodeForCreateArguments(type);
398 Output(bytecode);
399 return *this;
400 }
401
402
392 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral( 403 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral(
393 int literal_index, Register flags) { 404 int literal_index, Register flags) {
394 if (FitsInIdx8Operand(literal_index)) { 405 if (FitsInIdx8Operand(literal_index)) {
395 Output(Bytecode::kCreateRegExpLiteral, static_cast<uint8_t>(literal_index), 406 Output(Bytecode::kCreateRegExpLiteral, static_cast<uint8_t>(literal_index),
396 flags.ToOperand()); 407 flags.ToOperand());
397 } else { 408 } else {
398 UNIMPLEMENTED(); 409 UNIMPLEMENTED();
399 } 410 }
400 return *this; 411 return *this;
401 } 412 }
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 case STRONG: 994 case STRONG:
984 UNIMPLEMENTED(); 995 UNIMPLEMENTED();
985 default: 996 default:
986 UNREACHABLE(); 997 UNREACHABLE();
987 } 998 }
988 return static_cast<Bytecode>(-1); 999 return static_cast<Bytecode>(-1);
989 } 1000 }
990 1001
991 1002
992 // static 1003 // static
1004 Bytecode BytecodeArrayBuilder::BytecodeForCreateArguments(
1005 CreateArgumentsType type) {
1006 switch (type) {
1007 case CreateArgumentsType::kMappedArguments:
1008 return Bytecode::kCreateMappedArguments;
1009 case CreateArgumentsType::kUnmappedArguments:
1010 return Bytecode::kCreateUnmappedArguments;
1011 default:
1012 UNREACHABLE();
1013 }
1014 return static_cast<Bytecode>(-1);
1015 }
1016
1017
1018 // static
993 bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) { 1019 bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) {
994 return kMinUInt8 <= value && value <= kMaxUInt8; 1020 return kMinUInt8 <= value && value <= kMaxUInt8;
995 } 1021 }
996 1022
997 1023
998 // static 1024 // static
999 bool BytecodeArrayBuilder::FitsInIdx8Operand(size_t value) { 1025 bool BytecodeArrayBuilder::FitsInIdx8Operand(size_t value) {
1000 return value <= static_cast<size_t>(kMaxUInt8); 1026 return value <= static_cast<size_t>(kMaxUInt8);
1001 } 1027 }
1002 1028
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 DCHECK_GT(next_consecutive_count_, 0); 1075 DCHECK_GT(next_consecutive_count_, 0);
1050 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); 1076 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_);
1051 allocated_.push_back(next_consecutive_register_); 1077 allocated_.push_back(next_consecutive_register_);
1052 next_consecutive_count_--; 1078 next_consecutive_count_--;
1053 return Register(next_consecutive_register_++); 1079 return Register(next_consecutive_register_++);
1054 } 1080 }
1055 1081
1056 } // namespace interpreter 1082 } // namespace interpreter
1057 } // namespace internal 1083 } // namespace internal
1058 } // namespace v8 1084 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698