Index: test/cctest/interpreter/test-interpreter.cc |
diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc |
index df14c95acdc3ce18f7265c256a8e89ab34144a5d..4d658ffa4f93632e3b048c4b48ea8052e75d2bb2 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>(); |
@@ -523,16 +512,16 @@ TEST(InterpreterParameter8) { |
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 = |
@@ -544,6 +533,7 @@ TEST(InterpreterParameter1Assign) { |
TEST(InterpreterLoadGlobal) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
// Test loading a global. |
std::string source( |
@@ -551,7 +541,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(); |
@@ -561,8 +551,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( |
@@ -570,7 +560,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(); |
@@ -583,6 +573,7 @@ TEST(InterpreterStoreGlobal) { |
TEST(InterpreterCallGlobal) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
// Test calling a global function. |
std::string source( |
@@ -590,7 +581,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(); |
@@ -600,6 +591,7 @@ TEST(InterpreterCallGlobal) { |
TEST(InterpreterLoadUnallocated) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
// Test loading an unallocated global. |
std::string source( |
@@ -607,7 +599,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(); |
@@ -617,8 +609,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( |
@@ -626,7 +618,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(); |
@@ -639,27 +631,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 })"); |
@@ -693,28 +684,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 })"); |
@@ -736,27 +726,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>>(); |
@@ -796,21 +785,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)) |
@@ -818,7 +806,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>>(); |
@@ -844,16 +832,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); |
@@ -863,8 +851,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)); |
@@ -873,9 +860,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( |
@@ -886,17 +873,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( |
@@ -910,8 +896,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)) |
@@ -926,9 +911,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( |
@@ -941,8 +926,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)) |
@@ -973,9 +957,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( |
@@ -1019,18 +1003,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]; |
@@ -1049,8 +1032,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); |
@@ -1059,20 +1042,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); |
- |
- 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(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); |
+ |
+ 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]; |
@@ -1100,8 +1082,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); |
@@ -1110,20 +1092,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); |
- |
- 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(); |
+ Isolate* isolate = handles.main_isolate(); |
+ Zone zone(isolate->allocator()); |
+ BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); |
+ |
+ 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]; |
@@ -1151,8 +1132,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); |
@@ -1160,16 +1141,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; |
@@ -1178,7 +1158,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); |
} |
@@ -1197,7 +1177,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; |
@@ -1211,7 +1191,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)); |
@@ -1219,8 +1199,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; |
@@ -1228,14 +1208,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; |
@@ -1249,7 +1229,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); |
@@ -1308,8 +1288,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])) |
@@ -1318,8 +1298,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()); |
@@ -1344,9 +1324,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])) |
@@ -1355,8 +1335,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()); |
@@ -1370,8 +1350,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"}; |
@@ -1382,8 +1362,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) |
@@ -1391,8 +1370,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()); |
@@ -1411,7 +1390,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]; |
@@ -1421,13 +1400,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) { |
@@ -1446,8 +1425,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()); |
@@ -1461,24 +1441,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]); |
@@ -1532,7 +1513,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); |
@@ -1540,8 +1522,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]); |
@@ -1550,8 +1531,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()); |
@@ -1562,7 +1543,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); |
@@ -1570,8 +1552,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])) |
@@ -1580,8 +1561,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()); |
@@ -1592,10 +1573,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(); |
@@ -1603,8 +1584,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()); |
@@ -1639,7 +1620,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), |
@@ -1656,15 +1638,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()); |
@@ -1675,6 +1656,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"), |
@@ -1689,7 +1671,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 = |
@@ -1702,9 +1684,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)) |
@@ -1712,9 +1694,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(); |
@@ -1723,17 +1705,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(); |
@@ -1743,13 +1725,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( |
@@ -1760,8 +1743,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", |
@@ -1778,7 +1761,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(); |
@@ -1789,8 +1772,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", |
@@ -1809,7 +1792,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(); |
@@ -1820,8 +1803,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;", |
@@ -1862,7 +1845,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(); |
@@ -1873,6 +1856,7 @@ TEST(InterpreterObjectLiterals) { |
TEST(InterpreterConstruct) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::string source( |
"function counter() { this.count = 0; }\n" |
@@ -1882,7 +1866,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(); |
@@ -1892,6 +1876,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" |
@@ -1901,7 +1886,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(); |
@@ -1911,6 +1896,7 @@ TEST(InterpreterConstructWithArgument) { |
TEST(InterpreterConstructWithArguments) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::string source( |
"function counter(arg0, arg1) {\n" |
@@ -1922,7 +1908,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(); |
@@ -1932,7 +1918,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++) { |
@@ -1961,7 +1947,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(); |
@@ -1972,7 +1958,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; })();", |
@@ -1986,7 +1972,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>>(); |
@@ -2001,7 +1987,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;", |
@@ -2023,7 +2009,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(); |
@@ -2034,8 +2020,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()), |
@@ -2051,7 +2037,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(); |
@@ -2062,8 +2048,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()), |
@@ -2079,7 +2065,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(); |
@@ -2090,8 +2076,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", |
@@ -2112,7 +2098,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(); |
@@ -2123,7 +2109,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;", |
@@ -2139,7 +2125,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(); |
@@ -2150,8 +2136,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( |
@@ -2197,7 +2183,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)); |
@@ -2207,8 +2193,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", |
@@ -2230,7 +2216,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)); |
@@ -2240,8 +2226,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;", |
@@ -2293,7 +2279,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(); |
@@ -2304,7 +2290,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; }", |
@@ -2322,7 +2308,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(); |
@@ -2333,8 +2319,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;", |
@@ -2353,7 +2339,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(); |
@@ -2364,7 +2350,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;" |
@@ -2376,7 +2362,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(); |
@@ -2387,8 +2373,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), |
@@ -2424,7 +2410,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())); |
@@ -2432,7 +2418,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(); |
@@ -2451,7 +2437,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 = |
@@ -2463,7 +2449,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;", |
@@ -2486,7 +2472,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(); |
@@ -2497,8 +2483,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 |
@@ -2530,7 +2516,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(); |
@@ -2542,7 +2528,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(); |
@@ -2553,8 +2539,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. |
@@ -2581,7 +2567,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(); |
@@ -2592,8 +2578,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" |
@@ -2647,8 +2633,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(); |
@@ -2659,8 +2644,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" |
@@ -2744,7 +2729,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(); |
@@ -2921,6 +2906,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++) { |
@@ -2933,7 +2919,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(), |
@@ -2945,8 +2931,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" |
@@ -3045,7 +3031,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)); |
@@ -3055,8 +3041,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" |
@@ -3124,7 +3110,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(); |
@@ -3135,8 +3121,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" |
@@ -3158,7 +3144,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(); |
@@ -3169,10 +3155,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<>(); |
@@ -3183,13 +3169,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(); |
@@ -3201,6 +3186,7 @@ TEST(InterpreterNewTarget) { |
TEST(InterpreterAssignmentInExpressions) { |
HandleAndZoneScope handles; |
+ Isolate* isolate = handles.main_isolate(); |
std::pair<const char*, int> samples[] = { |
{"function f() {\n" |
@@ -3330,7 +3316,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())) |
@@ -3342,8 +3328,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;", |
@@ -3374,7 +3360,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(); |
@@ -3385,8 +3371,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) {" |
@@ -3408,7 +3394,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(); |
@@ -3419,8 +3405,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;" |
@@ -3445,7 +3431,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(); |
@@ -3456,7 +3442,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();", |
@@ -3472,7 +3458,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(); |
@@ -3483,8 +3469,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;" |
@@ -3516,7 +3502,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(); |
@@ -3527,8 +3513,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;" |
@@ -3557,7 +3543,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(); |
@@ -3568,10 +3554,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. |
@@ -3592,7 +3578,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(); |
@@ -3605,8 +3591,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)}, |
@@ -3644,7 +3630,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)); |
@@ -3654,7 +3640,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;');", |
@@ -3670,7 +3656,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 = |
@@ -3682,8 +3668,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()'); };" |
@@ -3698,8 +3684,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(); |
@@ -3710,8 +3695,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; }", |
@@ -3749,7 +3734,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(); |
@@ -3760,7 +3745,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" |
@@ -3773,8 +3758,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(); |
@@ -3784,7 +3768,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; |
@@ -3814,7 +3798,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); |
@@ -3828,6 +3812,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) { |
@@ -3840,8 +3827,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); |
@@ -3853,10 +3839,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"; |
@@ -3875,7 +3861,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(); |
@@ -3888,7 +3874,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"; |
@@ -3914,7 +3900,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); |
@@ -3930,7 +3916,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[] = { |
@@ -3946,7 +3932,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(); |
@@ -3958,7 +3944,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)}, |
@@ -3981,7 +3967,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(); |
@@ -3991,7 +3977,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" |
@@ -4042,7 +4028,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(); |
@@ -4052,7 +4038,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" |
@@ -4102,7 +4088,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)); |
@@ -4111,8 +4097,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)}, |
@@ -4144,7 +4130,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(); |
@@ -4156,7 +4142,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(); |
@@ -4166,8 +4152,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;", |
@@ -4183,7 +4169,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(); |
@@ -4195,7 +4181,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(); |
@@ -4205,7 +4191,7 @@ TEST(InterpreterConstDeclarationLookupSlots) { |
TEST(InterpreterConstInLookupContextChain) { |
HandleAndZoneScope handles; |
- i::Isolate* isolate = handles.main_isolate(); |
+ Isolate* isolate = handles.main_isolate(); |
const char* prologue = |
"function OuterMost() {\n" |
@@ -4240,7 +4226,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(); |
@@ -4250,6 +4236,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;", |
@@ -4269,7 +4256,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( |
@@ -4282,7 +4269,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( |
@@ -4293,8 +4280,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", |
@@ -4307,7 +4294,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(); |