Commit 78551682 authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpreter]: Add support for strict mode load / store ICs.

Adds support for strict mode load / store ICs and cleans up BinaryOp and
CompareOp to only trigger an UNIMPLEMENTED abort if called with STRONG
mode (which is the only language mode which has different compare/binary ops.

BUG=v8:4280
LOG=N

Review URL: https://codereview.chromium.org/1385623002

Cr-Commit-Position: refs/heads/master@{#31134}
parent 9081ee11
......@@ -255,25 +255,49 @@ void BytecodeGraphBuilder::VisitLdaGlobal(
}
void BytecodeGraphBuilder::VisitLoadIC(
void BytecodeGraphBuilder::VisitLoadICSloppy(
const interpreter::BytecodeArrayIterator& iterator) {
UNIMPLEMENTED();
}
void BytecodeGraphBuilder::VisitKeyedLoadIC(
void BytecodeGraphBuilder::VisitLoadICStrict(
const interpreter::BytecodeArrayIterator& iterator) {
UNIMPLEMENTED();
}
void BytecodeGraphBuilder::VisitStoreIC(
void BytecodeGraphBuilder::VisitKeyedLoadICSloppy(
const interpreter::BytecodeArrayIterator& iterator) {
UNIMPLEMENTED();
}
void BytecodeGraphBuilder::VisitKeyedStoreIC(
void BytecodeGraphBuilder::VisitKeyedLoadICStrict(
const interpreter::BytecodeArrayIterator& iterator) {
UNIMPLEMENTED();
}
void BytecodeGraphBuilder::VisitStoreICSloppy(
const interpreter::BytecodeArrayIterator& iterator) {
UNIMPLEMENTED();
}
void BytecodeGraphBuilder::VisitStoreICStrict(
const interpreter::BytecodeArrayIterator& iterator) {
UNIMPLEMENTED();
}
void BytecodeGraphBuilder::VisitKeyedStoreICSloppy(
const interpreter::BytecodeArrayIterator& iterator) {
UNIMPLEMENTED();
}
void BytecodeGraphBuilder::VisitKeyedStoreICStrict(
const interpreter::BytecodeArrayIterator& iterator) {
UNIMPLEMENTED();
}
......
......@@ -128,7 +128,12 @@ void BytecodeArrayBuilder::Output(Bytecode bytecode) {
BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(Token::Value op,
Register reg) {
Register reg,
Strength strength) {
if (is_strong(strength)) {
UNIMPLEMENTED();
}
Output(BytecodeForBinaryOperation(op), reg.ToOperand());
return *this;
}
......@@ -147,8 +152,8 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::TypeOf() {
BytecodeArrayBuilder& BytecodeArrayBuilder::CompareOperation(
Token::Value op, Register reg, LanguageMode language_mode) {
if (!is_sloppy(language_mode)) {
Token::Value op, Register reg, Strength strength) {
if (is_strong(strength)) {
UNIMPLEMENTED();
}
......@@ -238,13 +243,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(int slot_index) {
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
Register object, int feedback_slot, LanguageMode language_mode) {
if (!is_sloppy(language_mode)) {
UNIMPLEMENTED();
}
Bytecode bytecode = BytecodeForLoadIC(language_mode);
if (FitsInIdx8Operand(feedback_slot)) {
Output(Bytecode::kLoadIC, object.ToOperand(),
static_cast<uint8_t>(feedback_slot));
Output(bytecode, object.ToOperand(), static_cast<uint8_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
......@@ -254,13 +255,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty(
Register object, int feedback_slot, LanguageMode language_mode) {
if (!is_sloppy(language_mode)) {
UNIMPLEMENTED();
}
Bytecode bytecode = BytecodeForKeyedLoadIC(language_mode);
if (FitsInIdx8Operand(feedback_slot)) {
Output(Bytecode::kKeyedLoadIC, object.ToOperand(),
static_cast<uint8_t>(feedback_slot));
Output(bytecode, object.ToOperand(), static_cast<uint8_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
......@@ -271,12 +268,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty(
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty(
Register object, Register name, int feedback_slot,
LanguageMode language_mode) {
if (!is_sloppy(language_mode)) {
UNIMPLEMENTED();
}
Bytecode bytecode = BytecodeForStoreIC(language_mode);
if (FitsInIdx8Operand(feedback_slot)) {
Output(Bytecode::kStoreIC, object.ToOperand(), name.ToOperand(),
Output(bytecode, object.ToOperand(), name.ToOperand(),
static_cast<uint8_t>(feedback_slot));
} else {
UNIMPLEMENTED();
......@@ -288,12 +282,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty(
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
Register object, Register key, int feedback_slot,
LanguageMode language_mode) {
if (!is_sloppy(language_mode)) {
UNIMPLEMENTED();
}
Bytecode bytecode = BytecodeForKeyedStoreIC(language_mode);
if (FitsInIdx8Operand(feedback_slot)) {
Output(Bytecode::kKeyedStoreIC, object.ToOperand(), key.ToOperand(),
Output(bytecode, object.ToOperand(), key.ToOperand(),
static_cast<uint8_t>(feedback_slot));
} else {
UNIMPLEMENTED();
......@@ -619,6 +610,72 @@ Bytecode BytecodeArrayBuilder::BytecodeForCompareOperation(Token::Value op) {
}
// static
Bytecode BytecodeArrayBuilder::BytecodeForLoadIC(LanguageMode language_mode) {
switch (language_mode) {
case SLOPPY:
return Bytecode::kLoadICSloppy;
case STRICT:
return Bytecode::kLoadICStrict;
case STRONG:
UNIMPLEMENTED();
default:
UNREACHABLE();
}
return static_cast<Bytecode>(-1);
}
// static
Bytecode BytecodeArrayBuilder::BytecodeForKeyedLoadIC(
LanguageMode language_mode) {
switch (language_mode) {
case SLOPPY:
return Bytecode::kKeyedLoadICSloppy;
case STRICT:
return Bytecode::kKeyedLoadICStrict;
case STRONG:
UNIMPLEMENTED();
default:
UNREACHABLE();
}
return static_cast<Bytecode>(-1);
}
// static
Bytecode BytecodeArrayBuilder::BytecodeForStoreIC(LanguageMode language_mode) {
switch (language_mode) {
case SLOPPY:
return Bytecode::kStoreICSloppy;
case STRICT:
return Bytecode::kStoreICStrict;
case STRONG:
UNIMPLEMENTED();
default:
UNREACHABLE();
}
return static_cast<Bytecode>(-1);
}
// static
Bytecode BytecodeArrayBuilder::BytecodeForKeyedStoreIC(
LanguageMode language_mode) {
switch (language_mode) {
case SLOPPY:
return Bytecode::kKeyedStoreICSloppy;
case STRICT:
return Bytecode::kKeyedStoreICStrict;
case STRONG:
UNIMPLEMENTED();
default:
UNREACHABLE();
}
return static_cast<Bytecode>(-1);
}
// static
bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) {
return kMinUInt8 <= value && value <= kMaxUInt8;
......
......@@ -82,7 +82,8 @@ class BytecodeArrayBuilder {
Register first_arg, size_t arg_count);
// Operators (register == lhs, accumulator = rhs).
BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg);
BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg,
Strength strength);
// Unary Operators.
BytecodeArrayBuilder& LogicalNot();
......@@ -90,7 +91,7 @@ class BytecodeArrayBuilder {
// Tests.
BytecodeArrayBuilder& CompareOperation(Token::Value op, Register reg,
LanguageMode language_mode);
Strength strength);
// Casts
BytecodeArrayBuilder& CastAccumulatorToBoolean();
......@@ -117,6 +118,10 @@ class BytecodeArrayBuilder {
static Bytecode BytecodeForBinaryOperation(Token::Value op);
static Bytecode BytecodeForCompareOperation(Token::Value op);
static Bytecode BytecodeForLoadIC(LanguageMode language_mode);
static Bytecode BytecodeForKeyedLoadIC(LanguageMode language_mode);
static Bytecode BytecodeForStoreIC(LanguageMode language_mode);
static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode);
static bool FitsInIdx8Operand(int value);
static bool FitsInIdx8Operand(size_t value);
......
......@@ -687,7 +687,7 @@ void BytecodeGenerator::VisitCompareOperation(CompareOperation* expr) {
Visit(left);
builder()->StoreAccumulatorInRegister(temporary);
Visit(right);
builder()->CompareOperation(op, temporary, language_mode());
builder()->CompareOperation(op, temporary, language_mode_strength());
}
......@@ -726,7 +726,7 @@ void BytecodeGenerator::VisitArithmeticExpression(BinaryOperation* binop) {
Visit(left);
builder()->StoreAccumulatorInRegister(temporary);
Visit(right);
builder()->BinaryOperation(op, temporary);
builder()->BinaryOperation(op, temporary, language_mode_strength());
}
......@@ -735,6 +735,11 @@ LanguageMode BytecodeGenerator::language_mode() const {
}
Strength BytecodeGenerator::language_mode_strength() const {
return strength(language_mode());
}
int BytecodeGenerator::feedback_index(FeedbackVectorSlot slot) const {
return info()->feedback_vector()->GetIndex(slot);
}
......
......@@ -48,6 +48,7 @@ class BytecodeGenerator : public AstVisitor {
inline void set_info(CompilationInfo* info) { info_ = info; }
LanguageMode language_mode() const;
Strength language_mode_strength() const;
int feedback_index(FeedbackVectorSlot slot) const;
BytecodeArrayBuilder builder_;
......
This diff is collapsed.
......@@ -219,28 +219,52 @@ void Interpreter::DoPropertyLoadIC(Callable ic,
}
// LoadIC <object> <slot>
// LoadICSloppy <object> <slot>
//
// Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name
// in the accumulator.
void Interpreter::DoLoadIC(compiler::InterpreterAssembler* assembler) {
// Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and
// the name in the accumulator.
void Interpreter::DoLoadICSloppy(compiler::InterpreterAssembler* assembler) {
Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
SLOPPY, UNINITIALIZED);
DoPropertyLoadIC(ic, assembler);
}
// KeyedLoadIC <object> <slot>
// LoadICStrict <object> <slot>
//
// Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
// in the accumulator.
void Interpreter::DoKeyedLoadIC(compiler::InterpreterAssembler* assembler) {
// Calls the strict mode LoadIC at FeedBackVector slot <slot> for <object> and
// the name in the accumulator.
void Interpreter::DoLoadICStrict(compiler::InterpreterAssembler* assembler) {
Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
STRICT, UNINITIALIZED);
DoPropertyLoadIC(ic, assembler);
}
// KeyedLoadICSloppy <object> <slot>
//
// Calls the sloppy mode KeyedLoadIC at FeedBackVector slot <slot> for <object>
// and the key in the accumulator.
void Interpreter::DoKeyedLoadICSloppy(
compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
DoPropertyLoadIC(ic, assembler);
}
// KeyedLoadICStrict <object> <slot>
//
// Calls the strict mode KeyedLoadIC at FeedBackVector slot <slot> for <object>
// and the key in the accumulator.
void Interpreter::DoKeyedLoadICStrict(
compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::KeyedLoadICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
DoPropertyLoadIC(ic, assembler);
}
void Interpreter::DoPropertyStoreIC(Callable ic,
compiler::InterpreterAssembler* assembler) {
Node* code_target = __ HeapConstant(ic.code());
......@@ -259,28 +283,52 @@ void Interpreter::DoPropertyStoreIC(Callable ic,
}
// StoreIC <object> <name> <slot>
// StoreICSloppy <object> <name> <slot>
//
// Calls the StoreIC at FeedBackVector slot <slot> for <object> and the name
// <name> with the value in the accumulator.
void Interpreter::DoStoreIC(compiler::InterpreterAssembler* assembler) {
// Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and
// the name <name> with the value in the accumulator.
void Interpreter::DoStoreICSloppy(compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
DoPropertyStoreIC(ic, assembler);
}
// KeyedStoreIC <object> <key> <slot>
// StoreICStrict <object> <name> <slot>
//
// Calls the KeyStoreIC at FeedBackVector slot <slot> for <object> and the key
// <key> with the value in the accumulator.
void Interpreter::DoKeyedStoreIC(compiler::InterpreterAssembler* assembler) {
// Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and
// the name <name> with the value in the accumulator.
void Interpreter::DoStoreICStrict(compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
DoPropertyStoreIC(ic, assembler);
}
// KeyedStoreICSloppy <object> <key> <slot>
//
// Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object>
// and the key <key> with the value in the accumulator.
void Interpreter::DoKeyedStoreICSloppy(
compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
DoPropertyStoreIC(ic, assembler);
}
// KeyedStoreICStore <object> <key> <slot>
//
// Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object>
// and the key <key> with the value in the accumulator.
void Interpreter::DoKeyedStoreICStrict(
compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
DoPropertyStoreIC(ic, assembler);
}
void Interpreter::DoBinaryOp(Runtime::FunctionId function_id,
compiler::InterpreterAssembler* assembler) {
// TODO(rmcilroy): Call ICs which back-patch bytecode with type specialized
......
......@@ -155,6 +155,7 @@ using v8::internal::LanguageMode;
using v8::internal::Object;
using v8::internal::Runtime;
using v8::internal::Smi;
using v8::internal::Strength;
using v8::internal::Token;
using namespace v8::internal::interpreter;
......@@ -391,7 +392,7 @@ TEST(InterpreterBinaryOpsSmi) {
builder.LoadLiteral(Smi::FromInt(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(Smi::FromInt(rhs))
.BinaryOperation(kArithmeticOperators[o], reg)
.BinaryOperation(kArithmeticOperators[o], reg, Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -426,7 +427,7 @@ TEST(InterpreterBinaryOpsHeapNumber) {
builder.LoadLiteral(factory->NewNumber(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(factory->NewNumber(rhs))
.BinaryOperation(kArithmeticOperators[o], reg)
.BinaryOperation(kArithmeticOperators[o], reg, Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -482,7 +483,7 @@ TEST(InterpreterStringAdd) {
builder.LoadLiteral(test_cases[i].lhs)
.StoreAccumulatorInRegister(reg)
.LoadLiteral(test_cases[i].rhs)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -523,13 +524,13 @@ TEST(InterpreterParameter8) {
builder.set_locals_count(0);
builder.set_parameter_count(8);
builder.LoadAccumulatorWithRegister(builder.Parameter(0))
.BinaryOperation(Token::Value::ADD, builder.Parameter(1))
.BinaryOperation(Token::Value::ADD, builder.Parameter(2))
.BinaryOperation(Token::Value::ADD, builder.Parameter(3))
.BinaryOperation(Token::Value::ADD, builder.Parameter(4))
.BinaryOperation(Token::Value::ADD, builder.Parameter(5))
.BinaryOperation(Token::Value::ADD, builder.Parameter(6))
.BinaryOperation(Token::Value::ADD, builder.Parameter(7))
.BinaryOperation(Token::Value::ADD, builder.Parameter(1), Strength::WEAK)
.BinaryOperation(Token::Value::ADD, builder.Parameter(2), Strength::WEAK)
.BinaryOperation(Token::Value::ADD, builder.Parameter(3), Strength::WEAK)
.BinaryOperation(Token::Value::ADD, builder.Parameter(4), Strength::WEAK)
.BinaryOperation(Token::Value::ADD, builder.Parameter(5), Strength::WEAK)
.BinaryOperation(Token::Value::ADD, builder.Parameter(6), Strength::WEAK)
.BinaryOperation(Token::Value::ADD, builder.Parameter(7), Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -663,7 +664,7 @@ TEST(InterpreterLoadKeyedProperty) {
builder.set_parameter_count(1);
builder.LoadLiteral(key)
.LoadKeyedProperty(builder.Parameter(0), vector->GetIndex(slot),
i::SLOPPY)
i::STRICT)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -709,7 +710,7 @@ TEST(InterpreterStoreNamedProperty) {
.StoreAccumulatorInRegister(Register(0))
.LoadLiteral(Smi::FromInt(999))
.StoreNamedProperty(builder.Parameter(0), Register(0),
vector->GetIndex(slot), i::SLOPPY)
vector->GetIndex(slot), i::STRICT)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -955,7 +956,7 @@ static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder& builder,
Register scratch) {
return builder.StoreAccumulatorInRegister(scratch)
.LoadLiteral(Smi::FromInt(value))
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
.StoreAccumulatorInRegister(reg)
.LoadAccumulatorWithRegister(scratch);
}
......@@ -1085,7 +1086,7 @@ TEST(InterpreterSmiComparisons) {
builder.LoadLiteral(Smi::FromInt(inputs[i]))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(Smi::FromInt(inputs[j]))
.CompareOperation(comparison, r0, LanguageMode::SLOPPY)
.CompareOperation(comparison, r0, Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -1123,7 +1124,7 @@ TEST(InterpreterHeapNumberComparisons) {
builder.LoadLiteral(factory->NewHeapNumber(inputs[i]))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(factory->NewHeapNumber(inputs[j]))
.CompareOperation(comparison, r0, LanguageMode::SLOPPY)
.CompareOperation(comparison, r0, Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -1158,7 +1159,7 @@ TEST(InterpreterStringComparisons) {
builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(factory->NewStringFromAsciiChecked(rhs))
.CompareOperation(comparison, r0, LanguageMode::SLOPPY)
.CompareOperation(comparison, r0, Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -1206,14 +1207,14 @@ TEST(InterpreterMixedComparisons) {
builder.LoadLiteral(factory->NewNumber(lhs))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(factory->NewStringFromAsciiChecked(rhs_cstr))
.CompareOperation(comparison, r0, LanguageMode::SLOPPY)
.CompareOperation(comparison, r0, Strength::WEAK)
.Return();
} else {
// Comparison with HeapNumber on the rhs and String on the lhs
builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs_cstr))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(factory->NewNumber(rhs))
.CompareOperation(comparison, r0, LanguageMode::SLOPPY)
.CompareOperation(comparison, r0, Strength::WEAK)
.Return();
}
......@@ -1248,7 +1249,7 @@ TEST(InterpreterInstanceOf) {
builder.LoadLiteral(cases[i]);
builder.StoreAccumulatorInRegister(r0)
.LoadLiteral(func)
.CompareOperation(Token::Value::INSTANCEOF, r0, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::INSTANCEOF, r0, Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -1278,7 +1279,7 @@ TEST(InterpreterTestIn) {
builder.LoadLiteral(factory->NewStringFromAsciiChecked(properties[i]))
.StoreAccumulatorInRegister(r0)
.LoadLiteral(Handle<Object>::cast(array))
.CompareOperation(Token::Value::IN, r0, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::IN, r0, Strength::WEAK)
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......
......@@ -207,7 +207,8 @@ TEST_F(BytecodeGraphBuilderTest, SimpleExpressionWithParameters) {
array_builder()->set_parameter_count(3);
array_builder()
->LoadAccumulatorWithRegister(array_builder()->Parameter(1))
.BinaryOperation(Token::Value::ADD, array_builder()->Parameter(2))
.BinaryOperation(Token::Value::ADD, array_builder()->Parameter(2),
Strength::WEAK)
.StoreAccumulatorInRegister(interpreter::Register(0))
.Return();
......@@ -231,7 +232,8 @@ TEST_F(BytecodeGraphBuilderTest, SimpleExpressionWithRegister) {
->LoadLiteral(Smi::FromInt(kLeft))
.StoreAccumulatorInRegister(interpreter::Register(0))
.LoadLiteral(Smi::FromInt(kRight))
.BinaryOperation(Token::Value::ADD, interpreter::Register(0))
.BinaryOperation(Token::Value::ADD, interpreter::Register(0),
Strength::WEAK)
.Return();
Graph* graph = GetCompletedGraph();
......
......@@ -47,33 +47,37 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
builder.LoadNamedProperty(reg, 0, LanguageMode::SLOPPY)
.LoadKeyedProperty(reg, 0, LanguageMode::SLOPPY)
.StoreNamedProperty(reg, reg, 0, LanguageMode::SLOPPY)
.StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY);
.StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY)
.LoadNamedProperty(reg, 0, LanguageMode::STRICT)
.LoadKeyedProperty(reg, 0, LanguageMode::STRICT)
.StoreNamedProperty(reg, reg, 0, LanguageMode::STRICT)
.StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT);
// Call operations.
builder.Call(reg, reg, 0);
builder.CallRuntime(Runtime::kIsArray, reg, 1);
// Emit binary operator invocations.
builder.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::SUB, reg)
.BinaryOperation(Token::Value::MUL, reg)
.BinaryOperation(Token::Value::DIV, reg)
.BinaryOperation(Token::Value::MOD, reg);
builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
.BinaryOperation(Token::Value::SUB, reg, Strength::WEAK)
.BinaryOperation(Token::Value::MUL, reg, Strength::WEAK)
.BinaryOperation(Token::Value::DIV, reg, Strength::WEAK)
.BinaryOperation(Token::Value::MOD, reg, Strength::WEAK);
// Emit unary operator invocations.
builder.LogicalNot().TypeOf();
// Emit test operator invocations.
builder.CompareOperation(Token::Value::EQ, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::NE, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::EQ_STRICT, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::NE_STRICT, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::LT, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::GT, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::LTE, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::GTE, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::INSTANCEOF, reg, LanguageMode::SLOPPY)
.CompareOperation(Token::Value::IN, reg, LanguageMode::SLOPPY);
builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
.CompareOperation(Token::Value::NE, reg, Strength::WEAK)
.CompareOperation(Token::Value::EQ_STRICT, reg, Strength::WEAK)
.CompareOperation(Token::Value::NE_STRICT, reg, Strength::WEAK)
.CompareOperation(Token::Value::LT, reg, Strength::WEAK)
.CompareOperation(Token::Value::GT, reg, Strength::WEAK)
.CompareOperation(Token::Value::LTE, reg, Strength::WEAK)
.CompareOperation(Token::Value::GTE, reg, Strength::WEAK)
.CompareOperation(Token::Value::INSTANCEOF, reg, Strength::WEAK)
.CompareOperation(Token::Value::IN, reg, Strength::WEAK);
// Emit cast operator invocations.
builder.LoadNull().CastAccumulatorToBoolean();
......
......@@ -79,7 +79,7 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
CHECK(!iterator.done());
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadIC);
CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadICSloppy);
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
CHECK_EQ(iterator.GetIndexOperand(1), feedback_slot);
CHECK(!iterator.done());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment