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

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 1410003003: [Interpreter] Add support for JS runtime calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_api_builtin
Patch Set: Rebased Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-array-iterator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index cca0db87613d3191880973ccbd47680ac228608d..87c61358e884a45884b4a08ec636d66c541015fa 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -782,6 +782,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
BytecodeArrayBuilder& BytecodeArrayBuilder::New(Register constructor,
Register first_arg,
size_t arg_count) {
+ if (!first_arg.is_valid()) {
+ DCHECK_EQ(0, arg_count);
+ first_arg = Register(0);
+ }
DCHECK(FitsInIdx8Operand(arg_count));
Output(Bytecode::kNew, constructor.ToOperand(), first_arg.ToOperand(),
static_cast<uint8_t>(arg_count));
@@ -793,12 +797,27 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CallRuntime(
Runtime::FunctionId function_id, Register first_arg, size_t arg_count) {
DCHECK(FitsInIdx16Operand(function_id));
DCHECK(FitsInIdx8Operand(arg_count));
+ if (!first_arg.is_valid()) {
+ DCHECK_EQ(0, arg_count);
+ first_arg = Register(0);
+ }
Output(Bytecode::kCallRuntime, static_cast<uint16_t>(function_id),
first_arg.ToOperand(), static_cast<uint8_t>(arg_count));
return *this;
}
+BytecodeArrayBuilder& BytecodeArrayBuilder::CallJSRuntime(int context_index,
+ Register receiver,
+ size_t arg_count) {
+ DCHECK(FitsInIdx16Operand(context_index));
+ DCHECK(FitsInIdx8Operand(arg_count));
+ Output(Bytecode::kCallJSRuntime, static_cast<uint16_t>(context_index),
+ receiver.ToOperand(), static_cast<uint8_t>(arg_count));
+ return *this;
+}
+
+
BytecodeArrayBuilder& BytecodeArrayBuilder::Delete(Register object,
LanguageMode language_mode) {
Output(BytecodeForDelete(language_mode), object.ToOperand());
@@ -910,6 +929,11 @@ bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index,
case OperandType::kImm8:
case OperandType::kIdx8:
return static_cast<uint8_t>(operand_value) == operand_value;
+ case OperandType::kMaybeReg8:
+ if (operand_value == 0) {
+ return true;
+ }
+ // Fall-through to kReg8 case.
case OperandType::kReg8: {
Register reg = Register::FromOperand(static_cast<uint8_t>(operand_value));
if (reg.is_function_context() || reg.is_function_closure()) {
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-array-iterator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698