Index: test/cctest/interpreter/test-interpreter.cc |
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc |
index ef45820dfad21c240a91f3dac3f879594bd030d7..0d15097e4e2a3e1f1c5297b761b11cdb1dfeab71 100644 |
--- a/test/cctest/interpreter/test-interpreter.cc |
+++ b/test/cctest/interpreter/test-interpreter.cc |
@@ -21,15 +21,14 @@ namespace interpreter { |
TEST(InterpreterReturn) { |
HandleAndZoneScope handles; |
- Handle<Object> undefined_value = |
- handles.main_isolate()->factory()->undefined_value(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Handle<Object> undefined_value = isolate->factory()->undefined_value(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val.is_identical_to(undefined_value)); |
@@ -38,15 +37,14 @@ TEST(InterpreterReturn) { |
TEST(InterpreterLoadUndefined) { |
HandleAndZoneScope handles; |
- Handle<Object> undefined_value = |
- handles.main_isolate()->factory()->undefined_value(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Handle<Object> undefined_value = isolate->factory()->undefined_value(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadUndefined().Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val.is_identical_to(undefined_value)); |
@@ -55,14 +53,14 @@ TEST(InterpreterLoadUndefined) { |
TEST(InterpreterLoadNull) { |
HandleAndZoneScope handles; |
- Handle<Object> null_value = handles.main_isolate()->factory()->null_value(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Handle<Object> null_value = isolate->factory()->null_value(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadNull().Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val.is_identical_to(null_value)); |
@@ -71,15 +69,14 @@ TEST(InterpreterLoadNull) { |
TEST(InterpreterLoadTheHole) { |
HandleAndZoneScope handles; |
- Handle<Object> the_hole_value = |
- handles.main_isolate()->factory()->the_hole_value(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Handle<Object> the_hole_value = isolate->factory()->the_hole_value(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadTheHole().Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val.is_identical_to(the_hole_value)); |
@@ -88,14 +85,14 @@ TEST(InterpreterLoadTheHole) { |
TEST(InterpreterLoadTrue) { |
HandleAndZoneScope handles; |
- Handle<Object> true_value = handles.main_isolate()->factory()->true_value(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Handle<Object> true_value = isolate->factory()->true_value(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadTrue().Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val.is_identical_to(true_value)); |
@@ -104,14 +101,14 @@ TEST(InterpreterLoadTrue) { |
TEST(InterpreterLoadFalse) { |
HandleAndZoneScope handles; |
- Handle<Object> false_value = handles.main_isolate()->factory()->false_value(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Handle<Object> false_value = isolate->factory()->false_value(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadFalse().Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val.is_identical_to(false_value)); |
@@ -120,16 +117,16 @@ TEST(InterpreterLoadFalse) { |
TEST(InterpreterLoadLiteral) { |
HandleAndZoneScope handles; |
- i::Factory* factory = handles.main_isolate()->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// Small Smis. |
for (int i = -128; i < 128; i++) { |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadLiteral(Smi::FromInt(i)).Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(i)); |
@@ -137,13 +134,12 @@ TEST(InterpreterLoadLiteral) { |
// Large Smis. |
{ |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadLiteral(Smi::FromInt(0x12345678)).Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(0x12345678)); |
@@ -151,13 +147,12 @@ TEST(InterpreterLoadLiteral) { |
// Heap numbers. |
{ |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadLiteral(factory->NewHeapNumber(-2.1e19)).Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK_EQ(i::HeapNumber::cast(*return_val)->value(), -2.1e19); |
@@ -165,14 +160,13 @@ TEST(InterpreterLoadLiteral) { |
// Strings. |
{ |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
Handle<i::String> string = factory->NewStringFromAsciiChecked("String"); |
builder.LoadLiteral(string).Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(i::String::cast(*return_val)->Equals(*string)); |
@@ -182,10 +176,10 @@ TEST(InterpreterLoadLiteral) { |
TEST(InterpreterLoadStoreRegisters) { |
HandleAndZoneScope handles; |
- Handle<Object> true_value = handles.main_isolate()->factory()->true_value(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Handle<Object> true_value = isolate->factory()->true_value(); |
for (int i = 0; i <= kMaxInt8; i++) { |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, i + 1); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, i + 1); |
Register reg(i); |
builder.LoadTrue() |
@@ -193,9 +187,9 @@ TEST(InterpreterLoadStoreRegisters) { |
.LoadFalse() |
.LoadAccumulatorWithRegister(reg) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val.is_identical_to(true_value)); |
@@ -267,16 +261,15 @@ TEST(InterpreterShiftOpsSmi) { |
for (size_t r = 0; r < arraysize(rhs_inputs); r++) { |
for (size_t o = 0; o < arraysize(kShiftOperators); o++) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
- BytecodeArrayBuilder builder(handles.main_isolate(), |
- handles.main_zone(), 1, 0, 1); |
- |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
+ |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Register reg(0); |
int lhs = lhs_inputs[l]; |
@@ -286,9 +279,9 @@ TEST(InterpreterShiftOpsSmi) { |
.LoadLiteral(Smi::FromInt(rhs)) |
.BinaryOperation(kShiftOperators[o], reg, vector->GetIndex(slot)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
Handle<Object> expected_value = |
@@ -307,16 +300,15 @@ TEST(InterpreterBinaryOpsSmi) { |
for (size_t r = 0; r < arraysize(rhs_inputs); r++) { |
for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
- BytecodeArrayBuilder builder(handles.main_isolate(), |
- handles.main_zone(), 1, 0, 1); |
- |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
+ |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Register reg(0); |
int lhs = lhs_inputs[l]; |
@@ -327,9 +319,9 @@ TEST(InterpreterBinaryOpsSmi) { |
.BinaryOperation(kArithmeticOperators[o], reg, |
vector->GetIndex(slot)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
Handle<Object> expected_value = |
@@ -349,16 +341,15 @@ TEST(InterpreterBinaryOpsHeapNumber) { |
for (size_t r = 0; r < arraysize(rhs_inputs); r++) { |
for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
- BytecodeArrayBuilder builder(handles.main_isolate(), |
- handles.main_zone(), 1, 0, 1); |
- |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
+ |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Register reg(0); |
double lhs = lhs_inputs[l]; |
@@ -369,9 +360,9 @@ TEST(InterpreterBinaryOpsHeapNumber) { |
.BinaryOperation(kArithmeticOperators[o], reg, |
vector->GetIndex(slot)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
Handle<Object> expected_value = |
@@ -385,9 +376,9 @@ TEST(InterpreterBinaryOpsHeapNumber) { |
TEST(InterpreterStringAdd) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
struct TestCase { |
Handle<Object> lhs; |
@@ -418,12 +409,11 @@ TEST(InterpreterStringAdd) { |
}; |
for (size_t i = 0; i < arraysize(test_cases); i++) { |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 1); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Register reg(0); |
builder.LoadLiteral(test_cases[i].lhs) |
@@ -431,9 +421,9 @@ TEST(InterpreterStringAdd) { |
.LoadLiteral(test_cases[i].rhs) |
.BinaryOperation(Token::Value::ADD, reg, vector->GetIndex(slot)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->SameValue(*test_cases[i].expected_value)); |
@@ -443,17 +433,17 @@ TEST(InterpreterStringAdd) { |
TEST(InterpreterParameter1) { |
HandleAndZoneScope handles; |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ Isolate* isolate = handles.main_isolate(); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadAccumulatorWithRegister(builder.Parameter(0)).Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<Handle<Object>>(); |
// Check for heap objects. |
- Handle<Object> true_value = handles.main_isolate()->factory()->true_value(); |
+ Handle<Object> true_value = isolate->factory()->true_value(); |
Handle<Object> return_val = callable(true_value).ToHandleChecked(); |
CHECK(return_val.is_identical_to(true_value)); |
@@ -466,22 +456,21 @@ TEST(InterpreterParameter1) { |
TEST(InterpreterParameter8) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Zone zone(isolate->allocator()); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 8, |
- 0, 0); |
- |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot5 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot6 = feedback_spec.AddGeneralSlot(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 8, 0, 0); |
+ |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot5 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot6 = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
builder.LoadAccumulatorWithRegister(builder.Parameter(0)) |
.BinaryOperation(Token::Value::ADD, builder.Parameter(1), |
@@ -499,9 +488,9 @@ TEST(InterpreterParameter8) { |
.BinaryOperation(Token::Value::ADD, builder.Parameter(7), |
vector->GetIndex(slot6)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
+ InterpreterTester tester(isolate, bytecode_array, vector); |
typedef Handle<Object> H; |
auto callable = tester.GetCallable<H, H, H, H, H, H, H, H>(); |
@@ -545,7 +534,7 @@ TEST(InterpreterBitwiseTypeFeedback) { |
.BinaryOperation(op, builder.Parameter(3), vector->GetIndex(slot2)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
InterpreterTester tester(isolate, bytecode_array, vector); |
typedef Handle<Object> H; |
@@ -578,16 +567,16 @@ TEST(InterpreterBitwiseTypeFeedback) { |
TEST(InterpreterParameter1Assign) { |
HandleAndZoneScope handles; |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ Isolate* isolate = handles.main_isolate(); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadLiteral(Smi::FromInt(5)) |
.StoreAccumulatorInRegister(builder.Parameter(0)) |
.LoadAccumulatorWithRegister(builder.Parameter(0)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> return_val = |
@@ -599,6 +588,7 @@ TEST(InterpreterParameter1Assign) { |
TEST(InterpreterLoadGlobal) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
// Test loading a global. |
std::string source( |
@@ -606,7 +596,7 @@ TEST(InterpreterLoadGlobal) { |
"function " + InterpreterTester::function_name() + "() {\n" |
" return global;\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
@@ -616,8 +606,8 @@ TEST(InterpreterLoadGlobal) { |
TEST(InterpreterStoreGlobal) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// Test storing to a global. |
std::string source( |
@@ -625,7 +615,7 @@ TEST(InterpreterStoreGlobal) { |
"function " + InterpreterTester::function_name() + "() {\n" |
" global = 999;\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
callable().ToHandleChecked(); |
@@ -638,6 +628,7 @@ TEST(InterpreterStoreGlobal) { |
TEST(InterpreterCallGlobal) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
// Test calling a global function. |
std::string source( |
@@ -645,7 +636,7 @@ TEST(InterpreterCallGlobal) { |
"function " + InterpreterTester::function_name() + "() {\n" |
" return g_add(5, 10);\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
@@ -655,6 +646,7 @@ TEST(InterpreterCallGlobal) { |
TEST(InterpreterLoadUnallocated) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
// Test loading an unallocated global. |
std::string source( |
@@ -662,7 +654,7 @@ TEST(InterpreterLoadUnallocated) { |
"function " + InterpreterTester::function_name() + "() {\n" |
" return unallocated;\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
@@ -672,8 +664,8 @@ TEST(InterpreterLoadUnallocated) { |
TEST(InterpreterStoreUnallocated) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// Test storing to an unallocated global. |
std::string source( |
@@ -681,7 +673,7 @@ TEST(InterpreterStoreUnallocated) { |
"function " + InterpreterTester::function_name() + "() {\n" |
" unallocated = 999;\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
callable().ToHandleChecked(); |
@@ -694,27 +686,26 @@ TEST(InterpreterStoreUnallocated) { |
TEST(InterpreterLoadNamedProperty) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
name = factory->string_table()->LookupString(isolate, name); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadNamedProperty(builder.Parameter(0), name, vector->GetIndex(slot)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
+ InterpreterTester tester(isolate, bytecode_array, vector); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> object = InterpreterTester::NewObject("({ val : 123 })"); |
@@ -748,28 +739,27 @@ TEST(InterpreterLoadNamedProperty) { |
TEST(InterpreterLoadKeyedProperty) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Handle<i::String> key = factory->NewStringFromAsciiChecked("key"); |
key = factory->string_table()->LookupString(isolate, key); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 1); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
builder.LoadLiteral(key) |
.LoadKeyedProperty(builder.Parameter(0), vector->GetIndex(slot)) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
+ InterpreterTester tester(isolate, bytecode_array, vector); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> object = InterpreterTester::NewObject("({ key : 123 })"); |
@@ -791,27 +781,26 @@ TEST(InterpreterLoadKeyedProperty) { |
TEST(InterpreterStoreNamedProperty) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
name = factory->string_table()->LookupString(isolate, name); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 0); |
builder.LoadLiteral(Smi::FromInt(999)) |
.StoreNamedProperty(builder.Parameter(0), name, vector->GetIndex(slot), |
- i::STRICT) |
+ STRICT) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
InterpreterTester tester(isolate, bytecode_array, vector); |
auto callable = tester.GetCallable<Handle<Object>>(); |
@@ -851,21 +840,20 @@ TEST(InterpreterStoreNamedProperty) { |
TEST(InterpreterStoreKeyedProperty) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
name = factory->string_table()->LookupString(isolate, name); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 1); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
builder.LoadLiteral(name) |
.StoreAccumulatorInRegister(Register(0)) |
@@ -873,7 +861,7 @@ TEST(InterpreterStoreKeyedProperty) { |
.StoreKeyedProperty(builder.Parameter(0), Register(0), |
vector->GetIndex(slot), i::SLOPPY) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
InterpreterTester tester(isolate, bytecode_array, vector); |
auto callable = tester.GetCallable<Handle<Object>>(); |
@@ -899,16 +887,16 @@ TEST(InterpreterStoreKeyedProperty) { |
static void TestInterpreterCall(TailCallMode tail_call_mode) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
- i::Zone zone(isolate->allocator()); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ Zone zone(isolate->allocator()); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
- i::FeedbackVectorSlot call_slot = feedback_spec.AddCallICSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
+ FeedbackVectorSlot call_slot = feedback_spec.AddCallICSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
int slot_index = vector->GetIndex(slot); |
int call_slot_index = -1; |
call_slot_index = vector->GetIndex(call_slot); |
@@ -918,8 +906,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
// Check with no args. |
{ |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 1); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) |
.StoreAccumulatorInRegister(Register(0)); |
@@ -928,9 +915,9 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
tail_call_mode); |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
+ InterpreterTester tester(isolate, bytecode_array, vector); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> object = InterpreterTester::NewObject( |
@@ -941,17 +928,16 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
// Check that receiver is passed properly. |
{ |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 1); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) |
.StoreAccumulatorInRegister(Register(0)); |
builder.Call(Register(0), builder.Parameter(0), 1, call_slot_index, |
tail_call_mode); |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
+ InterpreterTester tester(isolate, bytecode_array, vector); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> object = InterpreterTester::NewObject( |
@@ -965,8 +951,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
// Check with two parameters (+ receiver). |
{ |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 4); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 4); |
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) |
.StoreAccumulatorInRegister(Register(0)) |
@@ -981,9 +966,9 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
+ InterpreterTester tester(isolate, bytecode_array, vector); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> object = InterpreterTester::NewObject( |
@@ -996,8 +981,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
// Check with 10 parameters (+ receiver). |
{ |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 12); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 12); |
builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) |
.StoreAccumulatorInRegister(Register(0)) |
@@ -1028,9 +1012,9 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array, vector); |
+ InterpreterTester tester(isolate, bytecode_array, vector); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> object = InterpreterTester::NewObject( |
@@ -1074,18 +1058,17 @@ static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder& builder, |
TEST(InterpreterJumps) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Zone zone(isolate->allocator()); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, |
- 0, 2); |
+ Isolate* isolate = handles.main_isolate(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Register reg(0), scratch(1); |
BytecodeLabel label[3]; |
@@ -1104,8 +1087,8 @@ TEST(InterpreterJumps) { |
.LoadAccumulatorWithRegister(reg) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_value)->value(), 7); |
@@ -1114,20 +1097,19 @@ TEST(InterpreterJumps) { |
TEST(InterpreterConditionalJumps) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Zone zone(isolate->allocator()); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, |
- 0, 2); |
+ Isolate* isolate = handles.main_isolate(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Register reg(0), scratch(1); |
BytecodeLabel label[2]; |
@@ -1155,8 +1137,8 @@ TEST(InterpreterConditionalJumps) { |
.Bind(&done1) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_value)->value(), 7); |
@@ -1165,20 +1147,19 @@ TEST(InterpreterConditionalJumps) { |
TEST(InterpreterConditionalJumps2) { |
// TODO(oth): Add tests for all conditional jumps near and far. |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Zone zone(isolate->allocator()); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, |
- 0, 2); |
+ Isolate* isolate = handles.main_isolate(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); |
- i::FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Register reg(0), scratch(1); |
BytecodeLabel label[2]; |
@@ -1206,8 +1187,8 @@ TEST(InterpreterConditionalJumps2) { |
.Bind(&done1) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_value)->value(), 7); |
@@ -1215,16 +1196,15 @@ TEST(InterpreterConditionalJumps2) { |
TEST(InterpreterJumpConstantWith16BitOperand) { |
HandleAndZoneScope handles; |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 257); |
+ Isolate* isolate = handles.main_isolate(); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 257); |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Zone zone(isolate->allocator()); |
+ Zone zone(isolate->allocator()); |
- i::FeedbackVectorSpec feedback_spec(&zone); |
- i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
+ FeedbackVectorSpec feedback_spec(&zone); |
+ FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); |
Handle<i::TypeFeedbackVector> vector = |
- i::NewTypeFeedbackVector(isolate, &feedback_spec); |
+ NewTypeFeedbackVector(isolate, &feedback_spec); |
Register reg(0), scratch(256); |
BytecodeLabel done, fake; |
@@ -1233,7 +1213,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { |
builder.StoreAccumulatorInRegister(reg); |
// Consume all 8-bit operands |
for (int i = 1; i <= 256; i++) { |
- builder.LoadLiteral(handles.main_isolate()->factory()->NewNumber(i)); |
+ builder.LoadLiteral(isolate->factory()->NewNumber(i)); |
builder.BinaryOperation(Token::Value::ADD, reg, vector->GetIndex(slot)); |
builder.StoreAccumulatorInRegister(reg); |
} |
@@ -1252,7 +1232,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { |
builder.LoadAccumulatorWithRegister(reg); |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
BytecodeArrayIterator iterator(bytecode_array); |
bool found_16bit_constant_jump = false; |
@@ -1266,7 +1246,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { |
} |
CHECK(found_16bit_constant_jump); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_value)->value(), 256.0 / 2 * (1 + 256)); |
@@ -1274,8 +1254,8 @@ TEST(InterpreterJumpConstantWith16BitOperand) { |
TEST(InterpreterJumpWith32BitOperand) { |
HandleAndZoneScope handles; |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 1); |
+ Isolate* isolate = handles.main_isolate(); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
Register reg(0); |
BytecodeLabel done; |
@@ -1283,14 +1263,14 @@ TEST(InterpreterJumpWith32BitOperand) { |
builder.StoreAccumulatorInRegister(reg); |
// Consume all 16-bit constant pool entries |
for (int i = 1; i <= 65536; i++) { |
- builder.LoadLiteral(handles.main_isolate()->factory()->NewNumber(i)); |
+ builder.LoadLiteral(isolate->factory()->NewNumber(i)); |
} |
builder.Jump(&done); |
builder.LoadLiteral(Smi::FromInt(0)); |
builder.Bind(&done); |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
BytecodeArrayIterator iterator(bytecode_array); |
bool found_32bit_jump = false; |
@@ -1304,7 +1284,7 @@ TEST(InterpreterJumpWith32BitOperand) { |
} |
CHECK(found_32bit_jump); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK_EQ(Smi::cast(*return_value)->value(), 65536.0); |
@@ -1363,8 +1343,8 @@ TEST(InterpreterSmiComparisons) { |
for (size_t i = 0; i < arraysize(inputs); i++) { |
for (size_t j = 0; j < arraysize(inputs); j++) { |
HandleAndZoneScope handles; |
- BytecodeArrayBuilder builder(handles.main_isolate(), |
- handles.main_zone(), 0, 0, 1); |
+ Isolate* isolate = handles.main_isolate(); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
Register r0(0); |
builder.LoadLiteral(Smi::FromInt(inputs[i])) |
@@ -1373,8 +1353,8 @@ TEST(InterpreterSmiComparisons) { |
.CompareOperation(comparison, r0) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->IsBoolean()); |
@@ -1399,9 +1379,9 @@ TEST(InterpreterHeapNumberComparisons) { |
for (size_t i = 0; i < arraysize(inputs); i++) { |
for (size_t j = 0; j < arraysize(inputs); j++) { |
HandleAndZoneScope handles; |
- i::Factory* factory = handles.main_isolate()->factory(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), |
- handles.main_zone(), 0, 0, 1); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
Register r0(0); |
builder.LoadLiteral(factory->NewHeapNumber(inputs[i])) |
@@ -1410,8 +1390,8 @@ TEST(InterpreterHeapNumberComparisons) { |
.CompareOperation(comparison, r0) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->IsBoolean()); |
@@ -1425,8 +1405,8 @@ TEST(InterpreterHeapNumberComparisons) { |
TEST(InterpreterStringComparisons) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::string inputs[] = {"A", "abc", "z", "", "Foo!", "Foo"}; |
@@ -1437,8 +1417,7 @@ TEST(InterpreterStringComparisons) { |
CanonicalHandleScope canonical(isolate); |
const char* lhs = inputs[i].c_str(); |
const char* rhs = inputs[j].c_str(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), |
- handles.main_zone(), 0, 0, 1); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
Register r0(0); |
builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs)) |
.StoreAccumulatorInRegister(r0) |
@@ -1446,8 +1425,8 @@ TEST(InterpreterStringComparisons) { |
.CompareOperation(comparison, r0) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->IsBoolean()); |
@@ -1466,7 +1445,7 @@ TEST(InterpreterMixedComparisons) { |
// performed. |
const char* inputs[] = {"-1.77", "-40.333", "0.01", "55.77e5", "2.01"}; |
- i::UnicodeCache unicode_cache; |
+ UnicodeCache unicode_cache; |
for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { |
Token::Value comparison = kComparisonTypes[c]; |
@@ -1476,13 +1455,13 @@ TEST(InterpreterMixedComparisons) { |
const char* lhs_cstr = inputs[i]; |
const char* rhs_cstr = inputs[j]; |
double lhs = StringToDouble(&unicode_cache, lhs_cstr, |
- i::ConversionFlags::NO_FLAGS); |
+ ConversionFlags::NO_FLAGS); |
double rhs = StringToDouble(&unicode_cache, rhs_cstr, |
- i::ConversionFlags::NO_FLAGS); |
+ ConversionFlags::NO_FLAGS); |
HandleAndZoneScope handles; |
- i::Factory* factory = handles.main_isolate()->factory(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), |
- handles.main_zone(), 0, 0, 1); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
Register r0(0); |
if (pass == 0) { |
@@ -1501,8 +1480,9 @@ TEST(InterpreterMixedComparisons) { |
.Return(); |
} |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = |
+ builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->IsBoolean()); |
@@ -1516,24 +1496,25 @@ TEST(InterpreterMixedComparisons) { |
TEST(InterpreterStrictNotEqual) { |
HandleAndZoneScope handles; |
- i::Factory* factory = handles.main_isolate()->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
const char* code_snippet = |
"function f(lhs, rhs) {\n" |
" return lhs !== rhs;\n" |
"}\n" |
"f(0, 0);\n"; |
- InterpreterTester tester(handles.main_isolate(), code_snippet); |
+ InterpreterTester tester(isolate, code_snippet); |
auto callable = tester.GetCallable<Handle<Object>, Handle<Object>>(); |
// Test passing different types. |
const char* inputs[] = {"-1.77", "-40.333", "0.01", "55.77e5", "2.01"}; |
- i::UnicodeCache unicode_cache; |
+ UnicodeCache unicode_cache; |
for (size_t i = 0; i < arraysize(inputs); i++) { |
for (size_t j = 0; j < arraysize(inputs); j++) { |
- double lhs = StringToDouble(&unicode_cache, inputs[i], |
- i::ConversionFlags::NO_FLAGS); |
- double rhs = StringToDouble(&unicode_cache, inputs[j], |
- i::ConversionFlags::NO_FLAGS); |
+ double lhs = |
+ StringToDouble(&unicode_cache, inputs[i], ConversionFlags::NO_FLAGS); |
+ double rhs = |
+ StringToDouble(&unicode_cache, inputs[j], ConversionFlags::NO_FLAGS); |
Handle<Object> lhs_obj = factory->NewNumber(lhs); |
Handle<Object> rhs_obj = factory->NewStringFromAsciiChecked(inputs[j]); |
@@ -1587,7 +1568,8 @@ TEST(InterpreterStrictNotEqual) { |
TEST(InterpreterInstanceOf) { |
HandleAndZoneScope handles; |
- i::Factory* factory = handles.main_isolate()->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
Handle<i::String> name = factory->NewStringFromAsciiChecked("cons"); |
Handle<i::JSFunction> func = factory->NewFunction(name); |
Handle<i::JSObject> instance = factory->NewJSObject(func); |
@@ -1595,8 +1577,7 @@ TEST(InterpreterInstanceOf) { |
Handle<i::Object> cases[] = {Handle<i::Object>::cast(instance), other}; |
for (size_t i = 0; i < arraysize(cases); i++) { |
bool expected_value = (i == 0); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, |
- 0, 1); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
Register r0(0); |
builder.LoadLiteral(cases[i]); |
@@ -1605,8 +1586,8 @@ TEST(InterpreterInstanceOf) { |
.CompareOperation(Token::Value::INSTANCEOF, r0) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->IsBoolean()); |
@@ -1617,7 +1598,8 @@ TEST(InterpreterInstanceOf) { |
TEST(InterpreterTestIn) { |
HandleAndZoneScope handles; |
- i::Factory* factory = handles.main_isolate()->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// Allocate an array |
Handle<i::JSArray> array = |
factory->NewJSArray(0, i::ElementsKind::FAST_SMI_ELEMENTS); |
@@ -1625,8 +1607,7 @@ TEST(InterpreterTestIn) { |
const char* properties[] = {"length", "fuzzle", "x", "0"}; |
for (size_t i = 0; i < arraysize(properties); i++) { |
bool expected_value = (i == 0); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, |
- 0, 1); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
Register r0(0); |
builder.LoadLiteral(factory->NewStringFromAsciiChecked(properties[i])) |
@@ -1635,8 +1616,8 @@ TEST(InterpreterTestIn) { |
.CompareOperation(Token::Value::IN, r0) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->IsBoolean()); |
@@ -1647,10 +1628,10 @@ TEST(InterpreterTestIn) { |
TEST(InterpreterUnaryNot) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
for (size_t i = 1; i < 10; i++) { |
bool expected_value = ((i & 1) == 1); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 0); |
Register r0(0); |
builder.LoadFalse(); |
@@ -1658,8 +1639,8 @@ TEST(InterpreterUnaryNot) { |
builder.LogicalNot(); |
} |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->IsBoolean()); |
@@ -1694,7 +1675,8 @@ static void LoadAny(BytecodeArrayBuilder* builder, |
TEST(InterpreterUnaryNotNonBoolean) { |
HandleAndZoneScope handles; |
- i::Factory* factory = handles.main_isolate()->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<Handle<Object>, bool> object_type_tuples[] = { |
std::make_pair(factory->undefined_value(), true), |
@@ -1711,15 +1693,14 @@ TEST(InterpreterUnaryNotNonBoolean) { |
}; |
for (size_t i = 0; i < arraysize(object_type_tuples); i++) { |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0, |
- 0, 0); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 0); |
Register r0(0); |
LoadAny(&builder, factory, object_type_tuples[i].first); |
builder.LogicalNot(); |
builder.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->IsBoolean()); |
@@ -1730,6 +1711,7 @@ TEST(InterpreterUnaryNotNonBoolean) { |
TEST(InterpreterTypeof) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, const char*> typeof_vals[] = { |
std::make_pair("return typeof undefined;", "undefined"), |
@@ -1744,7 +1726,7 @@ TEST(InterpreterTypeof) { |
for (size_t i = 0; i < arraysize(typeof_vals); i++) { |
std::string source(InterpreterTester::SourceForBody(typeof_vals[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<v8::internal::String> return_value = |
@@ -1757,9 +1739,9 @@ TEST(InterpreterTypeof) { |
TEST(InterpreterCallRuntime) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 2); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 2); |
builder.LoadLiteral(Smi::FromInt(15)) |
.StoreAccumulatorInRegister(Register(0)) |
@@ -1767,9 +1749,9 @@ TEST(InterpreterCallRuntime) { |
.StoreAccumulatorInRegister(Register(1)) |
.CallRuntime(Runtime::kAdd, Register(0), 2) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
@@ -1778,17 +1760,17 @@ TEST(InterpreterCallRuntime) { |
TEST(InterpreterInvokeIntrinsic) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
- BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1, |
- 0, 2); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 2); |
builder.LoadLiteral(Smi::FromInt(15)) |
.StoreAccumulatorInRegister(Register(0)) |
.CallRuntime(Runtime::kInlineIsArray, Register(0), 1) |
.Return(); |
- Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(); |
+ Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); |
- InterpreterTester tester(handles.main_isolate(), bytecode_array); |
+ InterpreterTester tester(isolate, bytecode_array); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
@@ -1798,13 +1780,14 @@ TEST(InterpreterInvokeIntrinsic) { |
TEST(InterpreterFunctionLiteral) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
// Test calling a function literal. |
std::string source( |
"function " + InterpreterTester::function_name() + "(a) {\n" |
" return (function(x){ return x + 2; })(a);\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<i::Object> return_val = callable( |
@@ -1815,8 +1798,8 @@ TEST(InterpreterFunctionLiteral) { |
TEST(InterpreterRegExpLiterals) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> literals[] = { |
std::make_pair("return /abd/.exec('cccabbdd');\n", |
@@ -1833,7 +1816,7 @@ TEST(InterpreterRegExpLiterals) { |
for (size_t i = 0; i < arraysize(literals); i++) { |
std::string source(InterpreterTester::SourceForBody(literals[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -1844,8 +1827,8 @@ TEST(InterpreterRegExpLiterals) { |
TEST(InterpreterArrayLiterals) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> literals[] = { |
std::make_pair("return [][0];\n", |
@@ -1864,7 +1847,7 @@ TEST(InterpreterArrayLiterals) { |
for (size_t i = 0; i < arraysize(literals); i++) { |
std::string source(InterpreterTester::SourceForBody(literals[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -1875,8 +1858,8 @@ TEST(InterpreterArrayLiterals) { |
TEST(InterpreterObjectLiterals) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> literals[] = { |
std::make_pair("return { }.name;", |
@@ -1917,7 +1900,7 @@ TEST(InterpreterObjectLiterals) { |
for (size_t i = 0; i < arraysize(literals); i++) { |
std::string source(InterpreterTester::SourceForBody(literals[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -1928,6 +1911,7 @@ TEST(InterpreterObjectLiterals) { |
TEST(InterpreterConstruct) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::string source( |
"function counter() { this.count = 0; }\n" |
@@ -1937,7 +1921,7 @@ TEST(InterpreterConstruct) { |
" var c = new counter();\n" |
" return c.count;\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
@@ -1947,6 +1931,7 @@ TEST(InterpreterConstruct) { |
TEST(InterpreterConstructWithArgument) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::string source( |
"function counter(arg0) { this.count = 17; this.x = arg0; }\n" |
@@ -1956,7 +1941,7 @@ TEST(InterpreterConstructWithArgument) { |
" var c = new counter(3);\n" |
" return c.x;\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
@@ -1966,6 +1951,7 @@ TEST(InterpreterConstructWithArgument) { |
TEST(InterpreterConstructWithArguments) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::string source( |
"function counter(arg0, arg1) {\n" |
@@ -1977,7 +1963,7 @@ TEST(InterpreterConstructWithArguments) { |
" var c = new counter(3, 5);\n" |
" return c.count + c.x + c.y;\n" |
"}"); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
@@ -1987,7 +1973,7 @@ TEST(InterpreterConstructWithArguments) { |
TEST(InterpreterContextVariables) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::ostringstream unique_vars; |
for (int i = 0; i < 250; i++) { |
@@ -2016,7 +2002,7 @@ TEST(InterpreterContextVariables) { |
for (size_t i = 0; i < arraysize(context_vars); i++) { |
std::string source( |
InterpreterTester::SourceForBody(context_vars[i].first.c_str())); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2027,7 +2013,7 @@ TEST(InterpreterContextVariables) { |
TEST(InterpreterContextParameters) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> context_params[] = { |
std::make_pair("return (function() { return arg1; })();", |
@@ -2041,7 +2027,7 @@ TEST(InterpreterContextParameters) { |
for (size_t i = 0; i < arraysize(context_params); i++) { |
std::string source = "function " + InterpreterTester::function_name() + |
"(arg1, arg2, arg3) {" + context_params[i].first + "}"; |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = |
tester.GetCallable<Handle<Object>, Handle<Object>, Handle<Object>>(); |
@@ -2056,7 +2042,7 @@ TEST(InterpreterContextParameters) { |
TEST(InterpreterOuterContextVariables) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> context_vars[] = { |
std::make_pair("return outerVar * innerArg;", |
@@ -2078,7 +2064,7 @@ TEST(InterpreterOuterContextVariables) { |
for (size_t i = 0; i < arraysize(context_vars); i++) { |
std::string source = header + context_vars[i].first + footer; |
- InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); |
+ InterpreterTester tester(isolate, source.c_str(), "*"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2089,8 +2075,8 @@ TEST(InterpreterOuterContextVariables) { |
TEST(InterpreterComma) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> literals[] = { |
std::make_pair("var a; return 0, a;\n", factory->undefined_value()), |
@@ -2106,7 +2092,7 @@ TEST(InterpreterComma) { |
for (size_t i = 0; i < arraysize(literals); i++) { |
std::string source(InterpreterTester::SourceForBody(literals[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2117,8 +2103,8 @@ TEST(InterpreterComma) { |
TEST(InterpreterLogicalOr) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> literals[] = { |
std::make_pair("var a, b; return a || b;\n", factory->undefined_value()), |
@@ -2134,7 +2120,7 @@ TEST(InterpreterLogicalOr) { |
for (size_t i = 0; i < arraysize(literals); i++) { |
std::string source(InterpreterTester::SourceForBody(literals[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2145,8 +2131,8 @@ TEST(InterpreterLogicalOr) { |
TEST(InterpreterLogicalAnd) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> literals[] = { |
std::make_pair("var a, b = 10; return a && b;\n", |
@@ -2167,7 +2153,7 @@ TEST(InterpreterLogicalAnd) { |
for (size_t i = 0; i < arraysize(literals); i++) { |
std::string source(InterpreterTester::SourceForBody(literals[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2178,7 +2164,7 @@ TEST(InterpreterLogicalAnd) { |
TEST(InterpreterTryCatch) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> catches[] = { |
std::make_pair("var a = 1; try { a = 2 } catch(e) { a = 3 }; return a;", |
@@ -2194,7 +2180,7 @@ TEST(InterpreterTryCatch) { |
for (size_t i = 0; i < arraysize(catches); i++) { |
std::string source(InterpreterTester::SourceForBody(catches[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2205,8 +2191,8 @@ TEST(InterpreterTryCatch) { |
TEST(InterpreterTryFinally) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> finallies[] = { |
std::make_pair( |
@@ -2252,7 +2238,7 @@ TEST(InterpreterTryFinally) { |
for (size_t i = 0; i < arraysize(finallies); i++) { |
std::string source(InterpreterTester::SourceForBody(finallies[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
tester.GetCallable<>(); |
Handle<Object> wrapped = v8::Utils::OpenHandle(*CompileRun(try_wrapper)); |
CHECK(wrapped->SameValue(*finallies[i].second)); |
@@ -2262,8 +2248,8 @@ TEST(InterpreterTryFinally) { |
TEST(InterpreterThrow) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> throws[] = { |
std::make_pair("throw undefined;\n", |
@@ -2285,7 +2271,7 @@ TEST(InterpreterThrow) { |
for (size_t i = 0; i < arraysize(throws); i++) { |
std::string source(InterpreterTester::SourceForBody(throws[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
tester.GetCallable<>(); |
Handle<Object> thrown_obj = v8::Utils::OpenHandle(*CompileRun(try_wrapper)); |
CHECK(thrown_obj->SameValue(*throws[i].second)); |
@@ -2295,8 +2281,8 @@ TEST(InterpreterThrow) { |
TEST(InterpreterCountOperators) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> count_ops[] = { |
std::make_pair("var a = 1; return ++a;", |
@@ -2348,7 +2334,7 @@ TEST(InterpreterCountOperators) { |
for (size_t i = 0; i < arraysize(count_ops); i++) { |
std::string source(InterpreterTester::SourceForBody(count_ops[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2359,7 +2345,7 @@ TEST(InterpreterCountOperators) { |
TEST(InterpreterGlobalCountOperators) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> count_ops[] = { |
std::make_pair("var global = 100;function f(){ return ++global; }", |
@@ -2377,7 +2363,7 @@ TEST(InterpreterGlobalCountOperators) { |
}; |
for (size_t i = 0; i < arraysize(count_ops); i++) { |
- InterpreterTester tester(handles.main_isolate(), count_ops[i].first); |
+ InterpreterTester tester(isolate, count_ops[i].first); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2388,8 +2374,8 @@ TEST(InterpreterGlobalCountOperators) { |
TEST(InterpreterCompoundExpressions) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> compound_expr[] = { |
std::make_pair("var a = 1; a += 2; return a;", |
@@ -2408,7 +2394,7 @@ TEST(InterpreterCompoundExpressions) { |
for (size_t i = 0; i < arraysize(compound_expr); i++) { |
std::string source( |
InterpreterTester::SourceForBody(compound_expr[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2419,7 +2405,7 @@ TEST(InterpreterCompoundExpressions) { |
TEST(InterpreterGlobalCompoundExpressions) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> compound_expr[2] = { |
std::make_pair("var global = 100;" |
@@ -2431,7 +2417,7 @@ TEST(InterpreterGlobalCompoundExpressions) { |
}; |
for (size_t i = 0; i < arraysize(compound_expr); i++) { |
- InterpreterTester tester(handles.main_isolate(), compound_expr[i].first); |
+ InterpreterTester tester(isolate, compound_expr[i].first); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2442,8 +2428,8 @@ TEST(InterpreterGlobalCompoundExpressions) { |
TEST(InterpreterCreateArguments) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, int> create_args[] = { |
std::make_pair("function f() { return arguments[0]; }", 0), |
@@ -2479,7 +2465,7 @@ TEST(InterpreterCreateArguments) { |
// Test passing no arguments. |
for (size_t i = 0; i < arraysize(create_args); i++) { |
- InterpreterTester tester(handles.main_isolate(), create_args[i].first); |
+ InterpreterTester tester(isolate, create_args[i].first); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val.is_identical_to(factory->undefined_value())); |
@@ -2487,7 +2473,7 @@ TEST(InterpreterCreateArguments) { |
// Test passing one argument. |
for (size_t i = 0; i < arraysize(create_args); i++) { |
- InterpreterTester tester(handles.main_isolate(), create_args[i].first); |
+ InterpreterTester tester(isolate, create_args[i].first); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> return_val = |
callable(handle(Smi::FromInt(40), isolate)).ToHandleChecked(); |
@@ -2506,7 +2492,7 @@ TEST(InterpreterCreateArguments) { |
handle(Smi::FromInt(80), isolate), |
}; |
- InterpreterTester tester(handles.main_isolate(), create_args[i].first); |
+ InterpreterTester tester(isolate, create_args[i].first); |
auto callable = |
tester.GetCallable<Handle<Object>, Handle<Object>, Handle<Object>>(); |
Handle<Object> return_val = |
@@ -2518,7 +2504,7 @@ TEST(InterpreterCreateArguments) { |
TEST(InterpreterConditional) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> conditional[] = { |
std::make_pair("return true ? 2 : 3;", |
@@ -2541,7 +2527,7 @@ TEST(InterpreterConditional) { |
for (size_t i = 0; i < arraysize(conditional); i++) { |
std::string source(InterpreterTester::SourceForBody(conditional[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2552,8 +2538,8 @@ TEST(InterpreterConditional) { |
TEST(InterpreterDelete) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// Tests for delete for local variables that work both in strict |
// and sloppy modes |
@@ -2585,7 +2571,7 @@ TEST(InterpreterDelete) { |
// Test delete in sloppy mode |
for (size_t i = 0; i < arraysize(test_delete); i++) { |
std::string source(InterpreterTester::SourceForBody(test_delete[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2597,7 +2583,7 @@ TEST(InterpreterDelete) { |
std::string strict_test = |
"'use strict'; " + std::string(test_delete[i].first); |
std::string source(InterpreterTester::SourceForBody(strict_test.c_str())); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2608,8 +2594,8 @@ TEST(InterpreterDelete) { |
TEST(InterpreterDeleteSloppyUnqualifiedIdentifier) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// These tests generate a syntax error for strict mode. We don't |
// test for it here. |
@@ -2636,7 +2622,7 @@ TEST(InterpreterDeleteSloppyUnqualifiedIdentifier) { |
for (size_t i = 0; i < arraysize(test_delete); i++) { |
std::string source(InterpreterTester::SourceForBody(test_delete[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2647,8 +2633,8 @@ TEST(InterpreterDeleteSloppyUnqualifiedIdentifier) { |
TEST(InterpreterGlobalDelete) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> test_global_delete[] = { |
std::make_pair("var a = { x:10, y:'abc', z:30.2 };\n" |
@@ -2702,8 +2688,7 @@ TEST(InterpreterGlobalDelete) { |
factory->ToBoolean(true))}; |
for (size_t i = 0; i < arraysize(test_global_delete); i++) { |
- InterpreterTester tester(handles.main_isolate(), |
- test_global_delete[i].first); |
+ InterpreterTester tester(isolate, test_global_delete[i].first); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2714,8 +2699,8 @@ TEST(InterpreterGlobalDelete) { |
TEST(InterpreterBasicLoops) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> loops[] = { |
std::make_pair("var a = 10; var b = 1;\n" |
@@ -2799,7 +2784,7 @@ TEST(InterpreterBasicLoops) { |
for (size_t i = 0; i < arraysize(loops); i++) { |
std::string source(InterpreterTester::SourceForBody(loops[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -2976,6 +2961,7 @@ TEST(InterpreterForIn) { |
// used. |
for (int pass = 0; pass < 2; pass++) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::ostringstream wide_os; |
if (pass == 1) { |
for (int i = 0; i < 200; i++) { |
@@ -2988,7 +2974,7 @@ TEST(InterpreterForIn) { |
body_os << wide_os.str() << for_in_samples[i].first; |
std::string body(body_os.str()); |
std::string function = InterpreterTester::SourceForBody(body.c_str()); |
- InterpreterTester tester(handles.main_isolate(), function.c_str()); |
+ InterpreterTester tester(isolate, function.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK_EQ(Handle<Smi>::cast(return_val)->value(), |
@@ -3000,8 +2986,8 @@ TEST(InterpreterForIn) { |
TEST(InterpreterForOf) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> for_of[] = { |
{"function f() {\n" |
@@ -3100,7 +3086,7 @@ TEST(InterpreterForOf) { |
}; |
for (size_t i = 0; i < arraysize(for_of); i++) { |
- InterpreterTester tester(handles.main_isolate(), for_of[i].first); |
+ InterpreterTester tester(isolate, for_of[i].first); |
auto callable = tester.GetCallable<>(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
CHECK(return_val->SameValue(*for_of[i].second)); |
@@ -3110,8 +3096,8 @@ TEST(InterpreterForOf) { |
TEST(InterpreterSwitch) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> switch_ops[] = { |
std::make_pair("var a = 1;\n" |
@@ -3179,7 +3165,7 @@ TEST(InterpreterSwitch) { |
for (size_t i = 0; i < arraysize(switch_ops); i++) { |
std::string source(InterpreterTester::SourceForBody(switch_ops[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3190,8 +3176,8 @@ TEST(InterpreterSwitch) { |
TEST(InterpreterSloppyThis) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> sloppy_this[] = { |
std::make_pair("var global_val = 100;\n" |
@@ -3213,7 +3199,7 @@ TEST(InterpreterSloppyThis) { |
}; |
for (size_t i = 0; i < arraysize(sloppy_this); i++) { |
- InterpreterTester tester(handles.main_isolate(), sloppy_this[i].first); |
+ InterpreterTester tester(isolate, sloppy_this[i].first); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3224,10 +3210,10 @@ TEST(InterpreterSloppyThis) { |
TEST(InterpreterThisFunction) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
- InterpreterTester tester(handles.main_isolate(), |
+ InterpreterTester tester(isolate, |
"var f;\n f = function f() { return f.name; }"); |
auto callable = tester.GetCallable<>(); |
@@ -3238,13 +3224,12 @@ TEST(InterpreterThisFunction) { |
TEST(InterpreterNewTarget) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// TODO(rmcilroy): Add tests that we get the original constructor for |
// superclass constructors once we have class support. |
- InterpreterTester tester(handles.main_isolate(), |
- "function f() { this.a = new.target; }"); |
+ InterpreterTester tester(isolate, "function f() { this.a = new.target; }"); |
auto callable = tester.GetCallable<>(); |
callable().ToHandleChecked(); |
@@ -3256,6 +3241,7 @@ TEST(InterpreterNewTarget) { |
TEST(InterpreterAssignmentInExpressions) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, int> samples[] = { |
{"function f() {\n" |
@@ -3385,7 +3371,7 @@ TEST(InterpreterAssignmentInExpressions) { |
const int arg_value = 40; |
for (size_t i = 0; i < arraysize(samples); i++) { |
- InterpreterTester tester(handles.main_isolate(), samples[i].first); |
+ InterpreterTester tester(isolate, samples[i].first); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> return_val = |
callable(handle(Smi::FromInt(arg_value), handles.main_isolate())) |
@@ -3397,8 +3383,8 @@ TEST(InterpreterAssignmentInExpressions) { |
TEST(InterpreterToName) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> to_name_tests[] = { |
{"var a = 'val'; var obj = {[a] : 10}; return obj.val;", |
@@ -3429,7 +3415,7 @@ TEST(InterpreterToName) { |
for (size_t i = 0; i < arraysize(to_name_tests); i++) { |
std::string source( |
InterpreterTester::SourceForBody(to_name_tests[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3440,8 +3426,8 @@ TEST(InterpreterToName) { |
TEST(TemporaryRegisterAllocation) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> reg_tests[] = { |
{"function add(a, b, c) {" |
@@ -3463,7 +3449,7 @@ TEST(TemporaryRegisterAllocation) { |
}; |
for (size_t i = 0; i < arraysize(reg_tests); i++) { |
- InterpreterTester tester(handles.main_isolate(), reg_tests[i].first); |
+ InterpreterTester tester(isolate, reg_tests[i].first); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3474,8 +3460,8 @@ TEST(TemporaryRegisterAllocation) { |
TEST(InterpreterLookupSlot) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// TODO(mythria): Add more tests when we have support for eval/with. |
const char* function_prologue = "var f;" |
@@ -3500,7 +3486,7 @@ TEST(InterpreterLookupSlot) { |
std::string(lookup_slot[i].first) + |
std::string(function_epilogue); |
- InterpreterTester tester(handles.main_isolate(), script.c_str(), "t"); |
+ InterpreterTester tester(isolate, script.c_str(), "t"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3511,7 +3497,7 @@ TEST(InterpreterLookupSlot) { |
TEST(InterpreterCallLookupSlot) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> call_lookup[] = { |
{"g = function(){ return 2 }; eval(''); return g();", |
@@ -3527,7 +3513,7 @@ TEST(InterpreterCallLookupSlot) { |
for (size_t i = 0; i < arraysize(call_lookup); i++) { |
std::string source(InterpreterTester::SourceForBody(call_lookup[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3538,8 +3524,8 @@ TEST(InterpreterCallLookupSlot) { |
TEST(InterpreterLookupSlotWide) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
const char* function_prologue = |
"var f;" |
@@ -3571,7 +3557,7 @@ TEST(InterpreterLookupSlotWide) { |
std::string script = std::string(function_prologue) + lookup_slot[i].first + |
std::string(function_epilogue); |
- InterpreterTester tester(handles.main_isolate(), script.c_str(), "t"); |
+ InterpreterTester tester(isolate, script.c_str(), "t"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3582,8 +3568,8 @@ TEST(InterpreterLookupSlotWide) { |
TEST(InterpreterDeleteLookupSlot) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
// TODO(mythria): Add more tests when we have support for eval/with. |
const char* function_prologue = "var f;" |
@@ -3612,7 +3598,7 @@ TEST(InterpreterDeleteLookupSlot) { |
std::string(delete_lookup_slot[i].first) + |
std::string(function_epilogue); |
- InterpreterTester tester(handles.main_isolate(), script.c_str(), "t"); |
+ InterpreterTester tester(isolate, script.c_str(), "t"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3623,10 +3609,10 @@ TEST(InterpreterDeleteLookupSlot) { |
TEST(JumpWithConstantsAndWideConstants) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
const int kStep = 13; |
for (int constants = 11; constants < 256 + 3 * kStep; constants += kStep) { |
- auto isolate = handles.main_isolate(); |
- auto factory = isolate->factory(); |
std::ostringstream filler_os; |
// Generate a string that consumes constant pool entries and |
// spread out branch distances in script below. |
@@ -3647,7 +3633,7 @@ TEST(JumpWithConstantsAndWideConstants) { |
script_os << "}\n"; |
std::string script(script_os.str()); |
for (int a = 0; a < 3; a++) { |
- InterpreterTester tester(handles.main_isolate(), script.c_str()); |
+ InterpreterTester tester(isolate, script.c_str()); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> argument = factory->NewNumberFromInt(a); |
Handle<Object> return_val = callable(argument).ToHandleChecked(); |
@@ -3660,8 +3646,8 @@ TEST(JumpWithConstantsAndWideConstants) { |
TEST(InterpreterEval) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> eval[] = { |
{"return eval('1;');", handle(Smi::FromInt(1), isolate)}, |
@@ -3699,7 +3685,7 @@ TEST(InterpreterEval) { |
for (size_t i = 0; i < arraysize(eval); i++) { |
std::string source(InterpreterTester::SourceForBody(eval[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->SameValue(*eval[i].second)); |
@@ -3709,7 +3695,7 @@ TEST(InterpreterEval) { |
TEST(InterpreterEvalParams) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> eval_params[] = { |
{"var x = 10; return eval('x + p1;');", |
@@ -3725,7 +3711,7 @@ TEST(InterpreterEvalParams) { |
for (size_t i = 0; i < arraysize(eval_params); i++) { |
std::string source = "function " + InterpreterTester::function_name() + |
"(p1) {" + eval_params[i].first + "}"; |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<i::Object> return_value = |
@@ -3737,8 +3723,8 @@ TEST(InterpreterEvalParams) { |
TEST(InterpreterEvalGlobal) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> eval_global[] = { |
{"function add_global() { eval('function test() { z = 33; }; test()'); };" |
@@ -3753,8 +3739,7 @@ TEST(InterpreterEvalGlobal) { |
}; |
for (size_t i = 0; i < arraysize(eval_global); i++) { |
- InterpreterTester tester(handles.main_isolate(), eval_global[i].first, |
- "test"); |
+ InterpreterTester tester(isolate, eval_global[i].first, "test"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3765,8 +3750,8 @@ TEST(InterpreterEvalGlobal) { |
TEST(InterpreterEvalVariableDecl) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> eval_global[] = { |
{"function f() { eval('var x = 10; x++;'); return x; }", |
@@ -3804,7 +3789,7 @@ TEST(InterpreterEvalVariableDecl) { |
}; |
for (size_t i = 0; i < arraysize(eval_global); i++) { |
- InterpreterTester tester(handles.main_isolate(), eval_global[i].first, "*"); |
+ InterpreterTester tester(isolate, eval_global[i].first, "*"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3815,7 +3800,7 @@ TEST(InterpreterEvalVariableDecl) { |
TEST(InterpreterEvalFunctionDecl) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> eval_func_decl[] = { |
{"function f() {\n" |
@@ -3828,8 +3813,7 @@ TEST(InterpreterEvalFunctionDecl) { |
}; |
for (size_t i = 0; i < arraysize(eval_func_decl); i++) { |
- InterpreterTester tester(handles.main_isolate(), eval_func_decl[i].first, |
- "*"); |
+ InterpreterTester tester(isolate, eval_func_decl[i].first, "*"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -3839,7 +3823,7 @@ TEST(InterpreterEvalFunctionDecl) { |
TEST(InterpreterWideRegisterArithmetic) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
static const size_t kMaxRegisterForTest = 150; |
std::ostringstream os; |
@@ -3869,7 +3853,7 @@ TEST(InterpreterWideRegisterArithmetic) { |
os << "}\n"; |
std::string source = os.str(); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<Handle<Object>>(); |
for (size_t i = 0; i < kMaxRegisterForTest; i++) { |
Handle<Object> arg = handle(Smi::FromInt(static_cast<int>(i)), isolate); |
@@ -3883,6 +3867,9 @@ TEST(InterpreterCallWideRegisters) { |
static const int kLength = 512; |
static const int kStartChar = 65; |
+ HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
+ |
for (int pass = 0; pass < 3; pass += 1) { |
std::ostringstream os; |
for (int i = 0; i < pass * 97; i += 1) { |
@@ -3895,8 +3882,7 @@ TEST(InterpreterCallWideRegisters) { |
} |
os << ");"; |
std::string source = InterpreterTester::SourceForBody(os.str().c_str()); |
- HandleAndZoneScope handles; |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable(); |
Handle<Object> return_val = callable().ToHandleChecked(); |
Handle<String> return_string = Handle<String>::cast(return_val); |
@@ -3908,10 +3894,10 @@ TEST(InterpreterCallWideRegisters) { |
} |
TEST(InterpreterWideParametersPickOne) { |
+ HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
static const int kParameterCount = 130; |
for (int parameter = 0; parameter < 10; parameter++) { |
- HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
std::ostringstream os; |
os << "function " << InterpreterTester::function_name() << "(arg) {\n"; |
os << " function selector(i"; |
@@ -3930,7 +3916,7 @@ TEST(InterpreterWideParametersPickOne) { |
os << "}\n"; |
std::string source = os.str(); |
- InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); |
+ InterpreterTester tester(isolate, source.c_str(), "*"); |
auto callable = tester.GetCallable<Handle<Object>>(); |
Handle<Object> arg = handle(Smi::FromInt(0xaa55), isolate); |
Handle<Object> return_value = callable(arg).ToHandleChecked(); |
@@ -3943,7 +3929,7 @@ TEST(InterpreterWideParametersSummation) { |
static int kParameterCount = 200; |
static int kBaseValue = 17000; |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::ostringstream os; |
os << "function " << InterpreterTester::function_name() << "(arg) {\n"; |
os << " function summation(i"; |
@@ -3969,7 +3955,7 @@ TEST(InterpreterWideParametersSummation) { |
os << "}\n"; |
std::string source = os.str(); |
- InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); |
+ InterpreterTester tester(isolate, source.c_str(), "*"); |
auto callable = tester.GetCallable<Handle<Object>>(); |
for (int i = 0; i < kParameterCount; i++) { |
Handle<Object> arg = handle(Smi::FromInt(i), isolate); |
@@ -3985,7 +3971,7 @@ TEST(InterpreterDoExpression) { |
FLAG_harmony_do_expressions = true; |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> do_expr[] = { |
@@ -4001,7 +3987,7 @@ TEST(InterpreterDoExpression) { |
for (size_t i = 0; i < arraysize(do_expr); i++) { |
std::string source(InterpreterTester::SourceForBody(do_expr[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -4013,7 +3999,7 @@ TEST(InterpreterDoExpression) { |
TEST(InterpreterWithStatement) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> with_stmt[] = { |
{"with({x:42}) return x;", handle(Smi::FromInt(42), isolate)}, |
@@ -4036,7 +4022,7 @@ TEST(InterpreterWithStatement) { |
for (size_t i = 0; i < arraysize(with_stmt); i++) { |
std::string source(InterpreterTester::SourceForBody(with_stmt[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -4046,7 +4032,7 @@ TEST(InterpreterWithStatement) { |
TEST(InterpreterClassLiterals) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> examples[] = { |
{"class C {\n" |
" constructor(x) { this.x_ = x; }\n" |
@@ -4097,7 +4083,7 @@ TEST(InterpreterClassLiterals) { |
for (size_t i = 0; i < arraysize(examples); ++i) { |
std::string source(InterpreterTester::SourceForBody(examples[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); |
+ InterpreterTester tester(isolate, source.c_str(), "*"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -4107,7 +4093,7 @@ TEST(InterpreterClassLiterals) { |
TEST(InterpreterClassAndSuperClass) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, Handle<Object>> examples[] = { |
{"class A {\n" |
" constructor(x) { this.x_ = x; }\n" |
@@ -4157,7 +4143,7 @@ TEST(InterpreterClassAndSuperClass) { |
for (size_t i = 0; i < arraysize(examples); ++i) { |
std::string source(InterpreterTester::SourceForBody(examples[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str(), "*"); |
+ InterpreterTester tester(isolate, source.c_str(), "*"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
CHECK(return_value->SameValue(*examples[i].second)); |
@@ -4166,8 +4152,8 @@ TEST(InterpreterClassAndSuperClass) { |
TEST(InterpreterConstDeclaration) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> const_decl[] = { |
{"const x = 3; return x;", handle(Smi::FromInt(3), isolate)}, |
@@ -4199,7 +4185,7 @@ TEST(InterpreterConstDeclaration) { |
// Tests for sloppy mode. |
for (size_t i = 0; i < arraysize(const_decl); i++) { |
std::string source(InterpreterTester::SourceForBody(const_decl[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -4211,7 +4197,7 @@ TEST(InterpreterConstDeclaration) { |
std::string strict_body = |
"'use strict'; " + std::string(const_decl[i].first); |
std::string source(InterpreterTester::SourceForBody(strict_body.c_str())); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -4221,8 +4207,8 @@ TEST(InterpreterConstDeclaration) { |
TEST(InterpreterConstDeclarationLookupSlots) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> const_decl[] = { |
{"const x = 3; function f1() {return x;}; return x;", |
@@ -4238,7 +4224,7 @@ TEST(InterpreterConstDeclarationLookupSlots) { |
// Tests for sloppy mode. |
for (size_t i = 0; i < arraysize(const_decl); i++) { |
std::string source(InterpreterTester::SourceForBody(const_decl[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -4250,7 +4236,7 @@ TEST(InterpreterConstDeclarationLookupSlots) { |
std::string strict_body = |
"'use strict'; " + std::string(const_decl[i].first); |
std::string source(InterpreterTester::SourceForBody(strict_body.c_str())); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -4260,7 +4246,7 @@ TEST(InterpreterConstDeclarationLookupSlots) { |
TEST(InterpreterConstInLookupContextChain) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
const char* prologue = |
"function OuterMost() {\n" |
@@ -4295,7 +4281,7 @@ TEST(InterpreterConstInLookupContextChain) { |
std::string script = std::string(prologue) + |
std::string(const_decl[i].first) + |
std::string(epilogue); |
- InterpreterTester tester(handles.main_isolate(), script.c_str(), "*"); |
+ InterpreterTester tester(isolate, script.c_str(), "*"); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |
@@ -4305,6 +4291,7 @@ TEST(InterpreterConstInLookupContextChain) { |
TEST(InterpreterIllegalConstDeclaration) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, const char*> const_decl[] = { |
{"const x = x = 10 + 3; return x;", |
@@ -4324,7 +4311,7 @@ TEST(InterpreterIllegalConstDeclaration) { |
// Tests for sloppy mode. |
for (size_t i = 0; i < arraysize(const_decl); i++) { |
std::string source(InterpreterTester::SourceForBody(const_decl[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); |
v8::Local<v8::String> expected_string = v8_str(const_decl[i].second); |
CHECK( |
@@ -4337,7 +4324,7 @@ TEST(InterpreterIllegalConstDeclaration) { |
std::string strict_body = |
"'use strict'; " + std::string(const_decl[i].first); |
std::string source(InterpreterTester::SourceForBody(strict_body.c_str())); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
v8::Local<v8::String> message = tester.CheckThrowsReturnMessage()->Get(); |
v8::Local<v8::String> expected_string = v8_str(const_decl[i].second); |
CHECK( |
@@ -4348,8 +4335,8 @@ TEST(InterpreterIllegalConstDeclaration) { |
TEST(InterpreterGenerators) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
- i::Factory* factory = isolate->factory(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Factory* factory = isolate->factory(); |
std::pair<const char*, Handle<Object>> tests[] = { |
{"function* f() { }; return f().next().value", |
@@ -4362,7 +4349,7 @@ TEST(InterpreterGenerators) { |
for (size_t i = 0; i < arraysize(tests); i++) { |
std::string source(InterpreterTester::SourceForBody(tests[i].first)); |
- InterpreterTester tester(handles.main_isolate(), source.c_str()); |
+ InterpreterTester tester(isolate, source.c_str()); |
auto callable = tester.GetCallable<>(); |
Handle<i::Object> return_value = callable().ToHandleChecked(); |