| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <tuple> | 5 #include <tuple> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/execution.h" | 9 #include "src/execution.h" |
| 10 #include "src/handles.h" | 10 #include "src/handles.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 TEST(InterpreterShiftOpsSmi) { | 259 TEST(InterpreterShiftOpsSmi) { |
| 260 int lhs_inputs[] = {0, -17, -182, 1073741823, -1}; | 260 int lhs_inputs[] = {0, -17, -182, 1073741823, -1}; |
| 261 int rhs_inputs[] = {5, 2, 1, -1, -2, 0, 31, 32, -32, 64, 37}; | 261 int rhs_inputs[] = {5, 2, 1, -1, -2, 0, 31, 32, -32, 64, 37}; |
| 262 for (size_t l = 0; l < arraysize(lhs_inputs); l++) { | 262 for (size_t l = 0; l < arraysize(lhs_inputs); l++) { |
| 263 for (size_t r = 0; r < arraysize(rhs_inputs); r++) { | 263 for (size_t r = 0; r < arraysize(rhs_inputs); r++) { |
| 264 for (size_t o = 0; o < arraysize(kShiftOperators); o++) { | 264 for (size_t o = 0; o < arraysize(kShiftOperators); o++) { |
| 265 HandleAndZoneScope handles; | 265 HandleAndZoneScope handles; |
| 266 Isolate* isolate = handles.main_isolate(); | 266 Isolate* isolate = handles.main_isolate(); |
| 267 Factory* factory = isolate->factory(); | 267 Factory* factory = isolate->factory(); |
| 268 Zone zone(isolate->allocator()); | 268 Zone zone(isolate->allocator(), ZONE_NAME); |
| 269 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); | 269 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
| 270 | 270 |
| 271 FeedbackVectorSpec feedback_spec(&zone); | 271 FeedbackVectorSpec feedback_spec(&zone); |
| 272 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); | 272 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 273 Handle<i::TypeFeedbackVector> vector = | 273 Handle<i::TypeFeedbackVector> vector = |
| 274 NewTypeFeedbackVector(isolate, &feedback_spec); | 274 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 275 | 275 |
| 276 Register reg(0); | 276 Register reg(0); |
| 277 int lhs = lhs_inputs[l]; | 277 int lhs = lhs_inputs[l]; |
| 278 int rhs = rhs_inputs[r]; | 278 int rhs = rhs_inputs[r]; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 297 | 297 |
| 298 TEST(InterpreterBinaryOpsSmi) { | 298 TEST(InterpreterBinaryOpsSmi) { |
| 299 int lhs_inputs[] = {3266, 1024, 0, -17, -18000}; | 299 int lhs_inputs[] = {3266, 1024, 0, -17, -18000}; |
| 300 int rhs_inputs[] = {3266, 5, 4, 3, 2, 1, -1, -2}; | 300 int rhs_inputs[] = {3266, 5, 4, 3, 2, 1, -1, -2}; |
| 301 for (size_t l = 0; l < arraysize(lhs_inputs); l++) { | 301 for (size_t l = 0; l < arraysize(lhs_inputs); l++) { |
| 302 for (size_t r = 0; r < arraysize(rhs_inputs); r++) { | 302 for (size_t r = 0; r < arraysize(rhs_inputs); r++) { |
| 303 for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { | 303 for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { |
| 304 HandleAndZoneScope handles; | 304 HandleAndZoneScope handles; |
| 305 Isolate* isolate = handles.main_isolate(); | 305 Isolate* isolate = handles.main_isolate(); |
| 306 Factory* factory = isolate->factory(); | 306 Factory* factory = isolate->factory(); |
| 307 Zone zone(isolate->allocator()); | 307 Zone zone(isolate->allocator(), ZONE_NAME); |
| 308 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); | 308 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
| 309 | 309 |
| 310 FeedbackVectorSpec feedback_spec(&zone); | 310 FeedbackVectorSpec feedback_spec(&zone); |
| 311 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); | 311 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 312 Handle<i::TypeFeedbackVector> vector = | 312 Handle<i::TypeFeedbackVector> vector = |
| 313 NewTypeFeedbackVector(isolate, &feedback_spec); | 313 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 314 | 314 |
| 315 Register reg(0); | 315 Register reg(0); |
| 316 int lhs = lhs_inputs[l]; | 316 int lhs = lhs_inputs[l]; |
| 317 int rhs = rhs_inputs[r]; | 317 int rhs = rhs_inputs[r]; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 338 TEST(InterpreterBinaryOpsHeapNumber) { | 338 TEST(InterpreterBinaryOpsHeapNumber) { |
| 339 double lhs_inputs[] = {3266.101, 1024.12, 0.01, -17.99, -18000.833, 9.1e17}; | 339 double lhs_inputs[] = {3266.101, 1024.12, 0.01, -17.99, -18000.833, 9.1e17}; |
| 340 double rhs_inputs[] = {3266.101, 5.999, 4.778, 3.331, 2.643, | 340 double rhs_inputs[] = {3266.101, 5.999, 4.778, 3.331, 2.643, |
| 341 1.1, -1.8, -2.9, 8.3e-27}; | 341 1.1, -1.8, -2.9, 8.3e-27}; |
| 342 for (size_t l = 0; l < arraysize(lhs_inputs); l++) { | 342 for (size_t l = 0; l < arraysize(lhs_inputs); l++) { |
| 343 for (size_t r = 0; r < arraysize(rhs_inputs); r++) { | 343 for (size_t r = 0; r < arraysize(rhs_inputs); r++) { |
| 344 for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { | 344 for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) { |
| 345 HandleAndZoneScope handles; | 345 HandleAndZoneScope handles; |
| 346 Isolate* isolate = handles.main_isolate(); | 346 Isolate* isolate = handles.main_isolate(); |
| 347 Factory* factory = isolate->factory(); | 347 Factory* factory = isolate->factory(); |
| 348 Zone zone(isolate->allocator()); | 348 Zone zone(isolate->allocator(), ZONE_NAME); |
| 349 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); | 349 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); |
| 350 | 350 |
| 351 FeedbackVectorSpec feedback_spec(&zone); | 351 FeedbackVectorSpec feedback_spec(&zone); |
| 352 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); | 352 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 353 Handle<i::TypeFeedbackVector> vector = | 353 Handle<i::TypeFeedbackVector> vector = |
| 354 NewTypeFeedbackVector(isolate, &feedback_spec); | 354 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 355 | 355 |
| 356 Register reg(0); | 356 Register reg(0); |
| 357 double lhs = lhs_inputs[l]; | 357 double lhs = lhs_inputs[l]; |
| 358 double rhs = rhs_inputs[r]; | 358 double rhs = rhs_inputs[r]; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 | 377 |
| 378 | 378 |
| 379 TEST(InterpreterStringAdd) { | 379 TEST(InterpreterStringAdd) { |
| 380 HandleAndZoneScope handles; | 380 HandleAndZoneScope handles; |
| 381 Isolate* isolate = handles.main_isolate(); | 381 Isolate* isolate = handles.main_isolate(); |
| 382 Factory* factory = isolate->factory(); | 382 Factory* factory = isolate->factory(); |
| 383 Zone zone(isolate->allocator()); | 383 Zone zone(isolate->allocator(), ZONE_NAME); |
| 384 | 384 |
| 385 struct TestCase { | 385 struct TestCase { |
| 386 Handle<Object> lhs; | 386 Handle<Object> lhs; |
| 387 Handle<Object> rhs; | 387 Handle<Object> rhs; |
| 388 Handle<Object> expected_value; | 388 Handle<Object> expected_value; |
| 389 int32_t expected_feedback; | 389 int32_t expected_feedback; |
| 390 } test_cases[] = { | 390 } test_cases[] = { |
| 391 {factory->NewStringFromStaticChars("a"), | 391 {factory->NewStringFromStaticChars("a"), |
| 392 factory->NewStringFromStaticChars("b"), | 392 factory->NewStringFromStaticChars("b"), |
| 393 factory->NewStringFromStaticChars("ab"), | 393 factory->NewStringFromStaticChars("ab"), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // Check for Smis. | 465 // Check for Smis. |
| 466 return_val = callable(Handle<Smi>(Smi::FromInt(3), handles.main_isolate())) | 466 return_val = callable(Handle<Smi>(Smi::FromInt(3), handles.main_isolate())) |
| 467 .ToHandleChecked(); | 467 .ToHandleChecked(); |
| 468 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(3)); | 468 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(3)); |
| 469 } | 469 } |
| 470 | 470 |
| 471 | 471 |
| 472 TEST(InterpreterParameter8) { | 472 TEST(InterpreterParameter8) { |
| 473 HandleAndZoneScope handles; | 473 HandleAndZoneScope handles; |
| 474 Isolate* isolate = handles.main_isolate(); | 474 Isolate* isolate = handles.main_isolate(); |
| 475 Zone zone(isolate->allocator()); | 475 Zone zone(isolate->allocator(), ZONE_NAME); |
| 476 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 8, 0, 0); | 476 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 8, 0, 0); |
| 477 | 477 |
| 478 FeedbackVectorSpec feedback_spec(&zone); | 478 FeedbackVectorSpec feedback_spec(&zone); |
| 479 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); | 479 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 480 FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 480 FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 481 FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 481 FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 482 FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 482 FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 483 FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 483 FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 484 FeedbackVectorSlot slot5 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 484 FeedbackVectorSlot slot5 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 485 FeedbackVectorSlot slot6 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 485 FeedbackVectorSlot slot6 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 // Check for Smis. | 520 // Check for Smis. |
| 521 Handle<Object> return_val = | 521 Handle<Object> return_val = |
| 522 callable(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) | 522 callable(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) |
| 523 .ToHandleChecked(); | 523 .ToHandleChecked(); |
| 524 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(36)); | 524 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(36)); |
| 525 } | 525 } |
| 526 | 526 |
| 527 TEST(InterpreterBinaryOpTypeFeedback) { | 527 TEST(InterpreterBinaryOpTypeFeedback) { |
| 528 HandleAndZoneScope handles; | 528 HandleAndZoneScope handles; |
| 529 i::Isolate* isolate = handles.main_isolate(); | 529 i::Isolate* isolate = handles.main_isolate(); |
| 530 i::Zone zone(isolate->allocator()); | 530 i::Zone zone(isolate->allocator(), ZONE_NAME); |
| 531 | 531 |
| 532 struct BinaryOpExpectation { | 532 struct BinaryOpExpectation { |
| 533 Token::Value op; | 533 Token::Value op; |
| 534 Handle<Object> arg1; | 534 Handle<Object> arg1; |
| 535 Handle<Object> arg2; | 535 Handle<Object> arg2; |
| 536 Handle<Object> result; | 536 Handle<Object> result; |
| 537 int32_t feedback; | 537 int32_t feedback; |
| 538 }; | 538 }; |
| 539 | 539 |
| 540 BinaryOpExpectation const kTestCases[] = { | 540 BinaryOpExpectation const kTestCases[] = { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 Object* feedback0 = vector->Get(slot0); | 666 Object* feedback0 = vector->Get(slot0); |
| 667 CHECK(feedback0->IsSmi()); | 667 CHECK(feedback0->IsSmi()); |
| 668 CHECK_EQ(test_case.feedback, static_cast<Smi*>(feedback0)->value()); | 668 CHECK_EQ(test_case.feedback, static_cast<Smi*>(feedback0)->value()); |
| 669 CHECK(Object::Equals(test_case.result, return_val).ToChecked()); | 669 CHECK(Object::Equals(test_case.result, return_val).ToChecked()); |
| 670 } | 670 } |
| 671 } | 671 } |
| 672 | 672 |
| 673 TEST(InterpreterBinaryOpSmiTypeFeedback) { | 673 TEST(InterpreterBinaryOpSmiTypeFeedback) { |
| 674 HandleAndZoneScope handles; | 674 HandleAndZoneScope handles; |
| 675 i::Isolate* isolate = handles.main_isolate(); | 675 i::Isolate* isolate = handles.main_isolate(); |
| 676 i::Zone zone(isolate->allocator()); | 676 i::Zone zone(isolate->allocator(), ZONE_NAME); |
| 677 | 677 |
| 678 struct BinaryOpExpectation { | 678 struct BinaryOpExpectation { |
| 679 Token::Value op; | 679 Token::Value op; |
| 680 Handle<Object> arg1; | 680 Handle<Object> arg1; |
| 681 int32_t arg2; | 681 int32_t arg2; |
| 682 Handle<Object> result; | 682 Handle<Object> result; |
| 683 int32_t feedback; | 683 int32_t feedback; |
| 684 }; | 684 }; |
| 685 | 685 |
| 686 BinaryOpExpectation const kTestCases[] = { | 686 BinaryOpExpectation const kTestCases[] = { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 Object* feedback0 = vector->Get(slot0); | 770 Object* feedback0 = vector->Get(slot0); |
| 771 CHECK(feedback0->IsSmi()); | 771 CHECK(feedback0->IsSmi()); |
| 772 CHECK_EQ(test_case.feedback, static_cast<Smi*>(feedback0)->value()); | 772 CHECK_EQ(test_case.feedback, static_cast<Smi*>(feedback0)->value()); |
| 773 CHECK(Object::Equals(test_case.result, return_val).ToChecked()); | 773 CHECK(Object::Equals(test_case.result, return_val).ToChecked()); |
| 774 } | 774 } |
| 775 } | 775 } |
| 776 | 776 |
| 777 TEST(InterpreterUnaryOpFeedback) { | 777 TEST(InterpreterUnaryOpFeedback) { |
| 778 HandleAndZoneScope handles; | 778 HandleAndZoneScope handles; |
| 779 i::Isolate* isolate = handles.main_isolate(); | 779 i::Isolate* isolate = handles.main_isolate(); |
| 780 i::Zone zone(isolate->allocator()); | 780 i::Zone zone(isolate->allocator(), ZONE_NAME); |
| 781 | 781 |
| 782 Handle<Smi> smi_one = Handle<Smi>(Smi::FromInt(1), isolate); | 782 Handle<Smi> smi_one = Handle<Smi>(Smi::FromInt(1), isolate); |
| 783 Handle<Smi> smi_max = Handle<Smi>(Smi::FromInt(Smi::kMaxValue), isolate); | 783 Handle<Smi> smi_max = Handle<Smi>(Smi::FromInt(Smi::kMaxValue), isolate); |
| 784 Handle<Smi> smi_min = Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate); | 784 Handle<Smi> smi_min = Handle<Smi>(Smi::FromInt(Smi::kMinValue), isolate); |
| 785 Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(2.1); | 785 Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(2.1); |
| 786 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked("42"); | 786 Handle<String> str = isolate->factory()->NewStringFromAsciiChecked("42"); |
| 787 | 787 |
| 788 struct TestCase { | 788 struct TestCase { |
| 789 Token::Value op; | 789 Token::Value op; |
| 790 Handle<Smi> smi_feedback_value; | 790 Handle<Smi> smi_feedback_value; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 847 Object* feedback3 = vector->Get(slot3); | 847 Object* feedback3 = vector->Get(slot3); |
| 848 CHECK(feedback3->IsSmi()); | 848 CHECK(feedback3->IsSmi()); |
| 849 CHECK_EQ(BinaryOperationFeedback::kAny, | 849 CHECK_EQ(BinaryOperationFeedback::kAny, |
| 850 static_cast<Smi*>(feedback3)->value()); | 850 static_cast<Smi*>(feedback3)->value()); |
| 851 } | 851 } |
| 852 } | 852 } |
| 853 | 853 |
| 854 TEST(InterpreterBitwiseTypeFeedback) { | 854 TEST(InterpreterBitwiseTypeFeedback) { |
| 855 HandleAndZoneScope handles; | 855 HandleAndZoneScope handles; |
| 856 i::Isolate* isolate = handles.main_isolate(); | 856 i::Isolate* isolate = handles.main_isolate(); |
| 857 i::Zone zone(isolate->allocator()); | 857 i::Zone zone(isolate->allocator(), ZONE_NAME); |
| 858 const Token::Value kBitwiseBinaryOperators[] = { | 858 const Token::Value kBitwiseBinaryOperators[] = { |
| 859 Token::Value::BIT_OR, Token::Value::BIT_XOR, Token::Value::BIT_AND, | 859 Token::Value::BIT_OR, Token::Value::BIT_XOR, Token::Value::BIT_AND, |
| 860 Token::Value::SHL, Token::Value::SHR, Token::Value::SAR}; | 860 Token::Value::SHL, Token::Value::SHR, Token::Value::SAR}; |
| 861 | 861 |
| 862 for (Token::Value op : kBitwiseBinaryOperators) { | 862 for (Token::Value op : kBitwiseBinaryOperators) { |
| 863 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 4, 0, 0); | 863 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 4, 0, 0); |
| 864 | 864 |
| 865 i::FeedbackVectorSpec feedback_spec(&zone); | 865 i::FeedbackVectorSpec feedback_spec(&zone); |
| 866 i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 866 i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 867 i::FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 867 i::FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1023 Handle<i::Object> global_obj = | 1023 Handle<i::Object> global_obj = |
| 1024 Object::GetProperty(isolate->global_object(), name).ToHandleChecked(); | 1024 Object::GetProperty(isolate->global_object(), name).ToHandleChecked(); |
| 1025 CHECK_EQ(Smi::cast(*global_obj), Smi::FromInt(999)); | 1025 CHECK_EQ(Smi::cast(*global_obj), Smi::FromInt(999)); |
| 1026 } | 1026 } |
| 1027 | 1027 |
| 1028 | 1028 |
| 1029 TEST(InterpreterLoadNamedProperty) { | 1029 TEST(InterpreterLoadNamedProperty) { |
| 1030 HandleAndZoneScope handles; | 1030 HandleAndZoneScope handles; |
| 1031 Isolate* isolate = handles.main_isolate(); | 1031 Isolate* isolate = handles.main_isolate(); |
| 1032 Factory* factory = isolate->factory(); | 1032 Factory* factory = isolate->factory(); |
| 1033 Zone zone(isolate->allocator()); | 1033 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1034 | 1034 |
| 1035 FeedbackVectorSpec feedback_spec(&zone); | 1035 FeedbackVectorSpec feedback_spec(&zone); |
| 1036 FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); | 1036 FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
| 1037 | 1037 |
| 1038 Handle<i::TypeFeedbackVector> vector = | 1038 Handle<i::TypeFeedbackVector> vector = |
| 1039 NewTypeFeedbackVector(isolate, &feedback_spec); | 1039 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1040 | 1040 |
| 1041 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); | 1041 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
| 1042 name = factory->string_table()->LookupString(isolate, name); | 1042 name = factory->string_table()->LookupString(isolate, name); |
| 1043 | 1043 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1076 InterpreterTester::NewObject("({ val : 789, val4 : 123 })"); | 1076 InterpreterTester::NewObject("({ val : 789, val4 : 123 })"); |
| 1077 return_val = callable(object5).ToHandleChecked(); | 1077 return_val = callable(object5).ToHandleChecked(); |
| 1078 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); | 1078 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 | 1081 |
| 1082 TEST(InterpreterLoadKeyedProperty) { | 1082 TEST(InterpreterLoadKeyedProperty) { |
| 1083 HandleAndZoneScope handles; | 1083 HandleAndZoneScope handles; |
| 1084 Isolate* isolate = handles.main_isolate(); | 1084 Isolate* isolate = handles.main_isolate(); |
| 1085 Factory* factory = isolate->factory(); | 1085 Factory* factory = isolate->factory(); |
| 1086 Zone zone(isolate->allocator()); | 1086 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1087 | 1087 |
| 1088 FeedbackVectorSpec feedback_spec(&zone); | 1088 FeedbackVectorSpec feedback_spec(&zone); |
| 1089 FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); | 1089 FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); |
| 1090 | 1090 |
| 1091 Handle<i::TypeFeedbackVector> vector = | 1091 Handle<i::TypeFeedbackVector> vector = |
| 1092 NewTypeFeedbackVector(isolate, &feedback_spec); | 1092 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1093 | 1093 |
| 1094 Handle<i::String> key = factory->NewStringFromAsciiChecked("key"); | 1094 Handle<i::String> key = factory->NewStringFromAsciiChecked("key"); |
| 1095 key = factory->string_table()->LookupString(isolate, key); | 1095 key = factory->string_table()->LookupString(isolate, key); |
| 1096 | 1096 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1118 InterpreterTester::NewObject("({ key : 789, val2 : 123 })"); | 1118 InterpreterTester::NewObject("({ key : 789, val2 : 123 })"); |
| 1119 return_val = callable(object3).ToHandleChecked(); | 1119 return_val = callable(object3).ToHandleChecked(); |
| 1120 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); | 1120 CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(789)); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 | 1123 |
| 1124 TEST(InterpreterStoreNamedProperty) { | 1124 TEST(InterpreterStoreNamedProperty) { |
| 1125 HandleAndZoneScope handles; | 1125 HandleAndZoneScope handles; |
| 1126 Isolate* isolate = handles.main_isolate(); | 1126 Isolate* isolate = handles.main_isolate(); |
| 1127 Factory* factory = isolate->factory(); | 1127 Factory* factory = isolate->factory(); |
| 1128 Zone zone(isolate->allocator()); | 1128 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1129 | 1129 |
| 1130 FeedbackVectorSpec feedback_spec(&zone); | 1130 FeedbackVectorSpec feedback_spec(&zone); |
| 1131 FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); | 1131 FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); |
| 1132 | 1132 |
| 1133 Handle<i::TypeFeedbackVector> vector = | 1133 Handle<i::TypeFeedbackVector> vector = |
| 1134 NewTypeFeedbackVector(isolate, &feedback_spec); | 1134 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1135 | 1135 |
| 1136 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); | 1136 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
| 1137 name = factory->string_table()->LookupString(isolate, name); | 1137 name = factory->string_table()->LookupString(isolate, name); |
| 1138 | 1138 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1177 callable(object5).ToHandleChecked(); | 1177 callable(object5).ToHandleChecked(); |
| 1178 CHECK(Runtime::GetObjectProperty(isolate, object5, name).ToHandle(&result)); | 1178 CHECK(Runtime::GetObjectProperty(isolate, object5, name).ToHandle(&result)); |
| 1179 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); | 1179 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); |
| 1180 } | 1180 } |
| 1181 | 1181 |
| 1182 | 1182 |
| 1183 TEST(InterpreterStoreKeyedProperty) { | 1183 TEST(InterpreterStoreKeyedProperty) { |
| 1184 HandleAndZoneScope handles; | 1184 HandleAndZoneScope handles; |
| 1185 Isolate* isolate = handles.main_isolate(); | 1185 Isolate* isolate = handles.main_isolate(); |
| 1186 Factory* factory = isolate->factory(); | 1186 Factory* factory = isolate->factory(); |
| 1187 Zone zone(isolate->allocator()); | 1187 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1188 | 1188 |
| 1189 FeedbackVectorSpec feedback_spec(&zone); | 1189 FeedbackVectorSpec feedback_spec(&zone); |
| 1190 FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); | 1190 FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); |
| 1191 | 1191 |
| 1192 Handle<i::TypeFeedbackVector> vector = | 1192 Handle<i::TypeFeedbackVector> vector = |
| 1193 NewTypeFeedbackVector(isolate, &feedback_spec); | 1193 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1194 | 1194 |
| 1195 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); | 1195 Handle<i::String> name = factory->NewStringFromAsciiChecked("val"); |
| 1196 name = factory->string_table()->LookupString(isolate, name); | 1196 name = factory->string_table()->LookupString(isolate, name); |
| 1197 | 1197 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1224 InterpreterTester::NewObject("({ val : 456, other : 123 })"); | 1224 InterpreterTester::NewObject("({ val : 456, other : 123 })"); |
| 1225 callable(object2).ToHandleChecked(); | 1225 callable(object2).ToHandleChecked(); |
| 1226 CHECK(Runtime::GetObjectProperty(isolate, object2, name).ToHandle(&result)); | 1226 CHECK(Runtime::GetObjectProperty(isolate, object2, name).ToHandle(&result)); |
| 1227 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); | 1227 CHECK_EQ(Smi::cast(*result), Smi::FromInt(999)); |
| 1228 } | 1228 } |
| 1229 | 1229 |
| 1230 static void TestInterpreterCall(TailCallMode tail_call_mode) { | 1230 static void TestInterpreterCall(TailCallMode tail_call_mode) { |
| 1231 HandleAndZoneScope handles; | 1231 HandleAndZoneScope handles; |
| 1232 Isolate* isolate = handles.main_isolate(); | 1232 Isolate* isolate = handles.main_isolate(); |
| 1233 Factory* factory = isolate->factory(); | 1233 Factory* factory = isolate->factory(); |
| 1234 Zone zone(isolate->allocator()); | 1234 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1235 | 1235 |
| 1236 FeedbackVectorSpec feedback_spec(&zone); | 1236 FeedbackVectorSpec feedback_spec(&zone); |
| 1237 FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); | 1237 FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); |
| 1238 FeedbackVectorSlot call_slot = feedback_spec.AddCallICSlot(); | 1238 FeedbackVectorSlot call_slot = feedback_spec.AddCallICSlot(); |
| 1239 | 1239 |
| 1240 Handle<i::TypeFeedbackVector> vector = | 1240 Handle<i::TypeFeedbackVector> vector = |
| 1241 NewTypeFeedbackVector(isolate, &feedback_spec); | 1241 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1242 int slot_index = vector->GetIndex(slot); | 1242 int slot_index = vector->GetIndex(slot); |
| 1243 int call_slot_index = -1; | 1243 int call_slot_index = -1; |
| 1244 call_slot_index = vector->GetIndex(call_slot); | 1244 call_slot_index = vector->GetIndex(call_slot); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1400 .LoadLiteral(Smi::FromInt(value)) | 1400 .LoadLiteral(Smi::FromInt(value)) |
| 1401 .BinaryOperation(Token::Value::ADD, reg, slot_index) | 1401 .BinaryOperation(Token::Value::ADD, reg, slot_index) |
| 1402 .StoreAccumulatorInRegister(reg) | 1402 .StoreAccumulatorInRegister(reg) |
| 1403 .LoadAccumulatorWithRegister(scratch); | 1403 .LoadAccumulatorWithRegister(scratch); |
| 1404 } | 1404 } |
| 1405 | 1405 |
| 1406 | 1406 |
| 1407 TEST(InterpreterJumps) { | 1407 TEST(InterpreterJumps) { |
| 1408 HandleAndZoneScope handles; | 1408 HandleAndZoneScope handles; |
| 1409 Isolate* isolate = handles.main_isolate(); | 1409 Isolate* isolate = handles.main_isolate(); |
| 1410 Zone zone(isolate->allocator()); | 1410 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1411 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); | 1411 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); |
| 1412 | 1412 |
| 1413 FeedbackVectorSpec feedback_spec(&zone); | 1413 FeedbackVectorSpec feedback_spec(&zone); |
| 1414 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1414 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1415 FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1415 FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1416 FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1416 FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1417 | 1417 |
| 1418 Handle<i::TypeFeedbackVector> vector = | 1418 Handle<i::TypeFeedbackVector> vector = |
| 1419 NewTypeFeedbackVector(isolate, &feedback_spec); | 1419 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1420 | 1420 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1439 InterpreterTester tester(isolate, bytecode_array, vector); | 1439 InterpreterTester tester(isolate, bytecode_array, vector); |
| 1440 auto callable = tester.GetCallable<>(); | 1440 auto callable = tester.GetCallable<>(); |
| 1441 Handle<Object> return_value = callable().ToHandleChecked(); | 1441 Handle<Object> return_value = callable().ToHandleChecked(); |
| 1442 CHECK_EQ(Smi::cast(*return_value)->value(), 7); | 1442 CHECK_EQ(Smi::cast(*return_value)->value(), 7); |
| 1443 } | 1443 } |
| 1444 | 1444 |
| 1445 | 1445 |
| 1446 TEST(InterpreterConditionalJumps) { | 1446 TEST(InterpreterConditionalJumps) { |
| 1447 HandleAndZoneScope handles; | 1447 HandleAndZoneScope handles; |
| 1448 Isolate* isolate = handles.main_isolate(); | 1448 Isolate* isolate = handles.main_isolate(); |
| 1449 Zone zone(isolate->allocator()); | 1449 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1450 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); | 1450 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); |
| 1451 | 1451 |
| 1452 FeedbackVectorSpec feedback_spec(&zone); | 1452 FeedbackVectorSpec feedback_spec(&zone); |
| 1453 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1453 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1454 FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1454 FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1455 FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1455 FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1456 FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1456 FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1457 FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1457 FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1458 | 1458 |
| 1459 Handle<i::TypeFeedbackVector> vector = | 1459 Handle<i::TypeFeedbackVector> vector = |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1489 InterpreterTester tester(isolate, bytecode_array, vector); | 1489 InterpreterTester tester(isolate, bytecode_array, vector); |
| 1490 auto callable = tester.GetCallable<>(); | 1490 auto callable = tester.GetCallable<>(); |
| 1491 Handle<Object> return_value = callable().ToHandleChecked(); | 1491 Handle<Object> return_value = callable().ToHandleChecked(); |
| 1492 CHECK_EQ(Smi::cast(*return_value)->value(), 7); | 1492 CHECK_EQ(Smi::cast(*return_value)->value(), 7); |
| 1493 } | 1493 } |
| 1494 | 1494 |
| 1495 TEST(InterpreterConditionalJumps2) { | 1495 TEST(InterpreterConditionalJumps2) { |
| 1496 // TODO(oth): Add tests for all conditional jumps near and far. | 1496 // TODO(oth): Add tests for all conditional jumps near and far. |
| 1497 HandleAndZoneScope handles; | 1497 HandleAndZoneScope handles; |
| 1498 Isolate* isolate = handles.main_isolate(); | 1498 Isolate* isolate = handles.main_isolate(); |
| 1499 Zone zone(isolate->allocator()); | 1499 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1500 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); | 1500 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); |
| 1501 | 1501 |
| 1502 FeedbackVectorSpec feedback_spec(&zone); | 1502 FeedbackVectorSpec feedback_spec(&zone); |
| 1503 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1503 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1504 FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1504 FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1505 FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1505 FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1506 FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1506 FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1507 FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1507 FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1508 | 1508 |
| 1509 Handle<i::TypeFeedbackVector> vector = | 1509 Handle<i::TypeFeedbackVector> vector = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1540 auto callable = tester.GetCallable<>(); | 1540 auto callable = tester.GetCallable<>(); |
| 1541 Handle<Object> return_value = callable().ToHandleChecked(); | 1541 Handle<Object> return_value = callable().ToHandleChecked(); |
| 1542 CHECK_EQ(Smi::cast(*return_value)->value(), 7); | 1542 CHECK_EQ(Smi::cast(*return_value)->value(), 7); |
| 1543 } | 1543 } |
| 1544 | 1544 |
| 1545 TEST(InterpreterJumpConstantWith16BitOperand) { | 1545 TEST(InterpreterJumpConstantWith16BitOperand) { |
| 1546 HandleAndZoneScope handles; | 1546 HandleAndZoneScope handles; |
| 1547 Isolate* isolate = handles.main_isolate(); | 1547 Isolate* isolate = handles.main_isolate(); |
| 1548 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 257); | 1548 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 257); |
| 1549 | 1549 |
| 1550 Zone zone(isolate->allocator()); | 1550 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1551 | 1551 |
| 1552 FeedbackVectorSpec feedback_spec(&zone); | 1552 FeedbackVectorSpec feedback_spec(&zone); |
| 1553 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); | 1553 FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); |
| 1554 Handle<i::TypeFeedbackVector> vector = | 1554 Handle<i::TypeFeedbackVector> vector = |
| 1555 NewTypeFeedbackVector(isolate, &feedback_spec); | 1555 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1556 | 1556 |
| 1557 Register reg(0), scratch(256); | 1557 Register reg(0), scratch(256); |
| 1558 BytecodeLabel done, fake; | 1558 BytecodeLabel done, fake; |
| 1559 | 1559 |
| 1560 builder.LoadLiteral(Smi::kZero); | 1560 builder.LoadLiteral(Smi::kZero); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 12345678, | 1685 12345678, |
| 1686 v8::internal::kMaxInt / 4, | 1686 v8::internal::kMaxInt / 4, |
| 1687 v8::internal::kMaxInt / 2}; | 1687 v8::internal::kMaxInt / 2}; |
| 1688 | 1688 |
| 1689 for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { | 1689 for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { |
| 1690 Token::Value comparison = kComparisonTypes[c]; | 1690 Token::Value comparison = kComparisonTypes[c]; |
| 1691 for (size_t i = 0; i < arraysize(inputs); i++) { | 1691 for (size_t i = 0; i < arraysize(inputs); i++) { |
| 1692 for (size_t j = 0; j < arraysize(inputs); j++) { | 1692 for (size_t j = 0; j < arraysize(inputs); j++) { |
| 1693 HandleAndZoneScope handles; | 1693 HandleAndZoneScope handles; |
| 1694 Isolate* isolate = handles.main_isolate(); | 1694 Isolate* isolate = handles.main_isolate(); |
| 1695 Zone zone(isolate->allocator()); | 1695 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1696 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); | 1696 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
| 1697 | 1697 |
| 1698 FeedbackVectorSpec feedback_spec(&zone); | 1698 FeedbackVectorSpec feedback_spec(&zone); |
| 1699 FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); | 1699 FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); |
| 1700 Handle<i::TypeFeedbackVector> vector = | 1700 Handle<i::TypeFeedbackVector> vector = |
| 1701 NewTypeFeedbackVector(isolate, &feedback_spec); | 1701 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1702 | 1702 |
| 1703 Register r0(0); | 1703 Register r0(0); |
| 1704 builder.LoadLiteral(Smi::FromInt(inputs[i])) | 1704 builder.LoadLiteral(Smi::FromInt(inputs[i])) |
| 1705 .StoreAccumulatorInRegister(r0) | 1705 .StoreAccumulatorInRegister(r0) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1732 0.1000001, | 1732 0.1000001, |
| 1733 1e99, | 1733 1e99, |
| 1734 -1e-99}; | 1734 -1e-99}; |
| 1735 for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { | 1735 for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { |
| 1736 Token::Value comparison = kComparisonTypes[c]; | 1736 Token::Value comparison = kComparisonTypes[c]; |
| 1737 for (size_t i = 0; i < arraysize(inputs); i++) { | 1737 for (size_t i = 0; i < arraysize(inputs); i++) { |
| 1738 for (size_t j = 0; j < arraysize(inputs); j++) { | 1738 for (size_t j = 0; j < arraysize(inputs); j++) { |
| 1739 HandleAndZoneScope handles; | 1739 HandleAndZoneScope handles; |
| 1740 Isolate* isolate = handles.main_isolate(); | 1740 Isolate* isolate = handles.main_isolate(); |
| 1741 Factory* factory = isolate->factory(); | 1741 Factory* factory = isolate->factory(); |
| 1742 Zone zone(isolate->allocator()); | 1742 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1743 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); | 1743 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
| 1744 | 1744 |
| 1745 FeedbackVectorSpec feedback_spec(&zone); | 1745 FeedbackVectorSpec feedback_spec(&zone); |
| 1746 FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); | 1746 FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); |
| 1747 Handle<i::TypeFeedbackVector> vector = | 1747 Handle<i::TypeFeedbackVector> vector = |
| 1748 NewTypeFeedbackVector(isolate, &feedback_spec); | 1748 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1749 | 1749 |
| 1750 Register r0(0); | 1750 Register r0(0); |
| 1751 builder.LoadLiteral(factory->NewHeapNumber(inputs[i])) | 1751 builder.LoadLiteral(factory->NewHeapNumber(inputs[i])) |
| 1752 .StoreAccumulatorInRegister(r0) | 1752 .StoreAccumulatorInRegister(r0) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1768 } | 1768 } |
| 1769 } | 1769 } |
| 1770 } | 1770 } |
| 1771 } | 1771 } |
| 1772 | 1772 |
| 1773 | 1773 |
| 1774 TEST(InterpreterStringComparisons) { | 1774 TEST(InterpreterStringComparisons) { |
| 1775 HandleAndZoneScope handles; | 1775 HandleAndZoneScope handles; |
| 1776 Isolate* isolate = handles.main_isolate(); | 1776 Isolate* isolate = handles.main_isolate(); |
| 1777 Factory* factory = isolate->factory(); | 1777 Factory* factory = isolate->factory(); |
| 1778 Zone zone(isolate->allocator()); | 1778 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1779 | 1779 |
| 1780 std::string inputs[] = {"A", "abc", "z", "", "Foo!", "Foo"}; | 1780 std::string inputs[] = {"A", "abc", "z", "", "Foo!", "Foo"}; |
| 1781 | 1781 |
| 1782 for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { | 1782 for (size_t c = 0; c < arraysize(kComparisonTypes); c++) { |
| 1783 Token::Value comparison = kComparisonTypes[c]; | 1783 Token::Value comparison = kComparisonTypes[c]; |
| 1784 for (size_t i = 0; i < arraysize(inputs); i++) { | 1784 for (size_t i = 0; i < arraysize(inputs); i++) { |
| 1785 for (size_t j = 0; j < arraysize(inputs); j++) { | 1785 for (size_t j = 0; j < arraysize(inputs); j++) { |
| 1786 CanonicalHandleScope canonical(isolate); | 1786 CanonicalHandleScope canonical(isolate); |
| 1787 const char* lhs = inputs[i].c_str(); | 1787 const char* lhs = inputs[i].c_str(); |
| 1788 const char* rhs = inputs[j].c_str(); | 1788 const char* rhs = inputs[j].c_str(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 const char* lhs_cstr = inputs[i]; | 1834 const char* lhs_cstr = inputs[i]; |
| 1835 const char* rhs_cstr = inputs[j]; | 1835 const char* rhs_cstr = inputs[j]; |
| 1836 double lhs = StringToDouble(&unicode_cache, lhs_cstr, | 1836 double lhs = StringToDouble(&unicode_cache, lhs_cstr, |
| 1837 ConversionFlags::NO_FLAGS); | 1837 ConversionFlags::NO_FLAGS); |
| 1838 double rhs = StringToDouble(&unicode_cache, rhs_cstr, | 1838 double rhs = StringToDouble(&unicode_cache, rhs_cstr, |
| 1839 ConversionFlags::NO_FLAGS); | 1839 ConversionFlags::NO_FLAGS); |
| 1840 HandleAndZoneScope handles; | 1840 HandleAndZoneScope handles; |
| 1841 Isolate* isolate = handles.main_isolate(); | 1841 Isolate* isolate = handles.main_isolate(); |
| 1842 Factory* factory = isolate->factory(); | 1842 Factory* factory = isolate->factory(); |
| 1843 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); | 1843 BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); |
| 1844 Zone zone(isolate->allocator()); | 1844 Zone zone(isolate->allocator(), ZONE_NAME); |
| 1845 | 1845 |
| 1846 FeedbackVectorSpec feedback_spec(&zone); | 1846 FeedbackVectorSpec feedback_spec(&zone); |
| 1847 FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); | 1847 FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); |
| 1848 Handle<i::TypeFeedbackVector> vector = | 1848 Handle<i::TypeFeedbackVector> vector = |
| 1849 NewTypeFeedbackVector(isolate, &feedback_spec); | 1849 NewTypeFeedbackVector(isolate, &feedback_spec); |
| 1850 | 1850 |
| 1851 Register r0(0); | 1851 Register r0(0); |
| 1852 if (pass == 0) { | 1852 if (pass == 0) { |
| 1853 // Comparison with HeapNumber on the lhs and String on the rhs | 1853 // Comparison with HeapNumber on the lhs and String on the rhs |
| 1854 builder.LoadLiteral(factory->NewNumber(lhs)) | 1854 builder.LoadLiteral(factory->NewNumber(lhs)) |
| (...skipping 2966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4821 auto callable = tester.GetCallable<>(); | 4821 auto callable = tester.GetCallable<>(); |
| 4822 | 4822 |
| 4823 Handle<i::Object> return_value = callable().ToHandleChecked(); | 4823 Handle<i::Object> return_value = callable().ToHandleChecked(); |
| 4824 CHECK(return_value->SameValue(*tests[i].second)); | 4824 CHECK(return_value->SameValue(*tests[i].second)); |
| 4825 } | 4825 } |
| 4826 } | 4826 } |
| 4827 | 4827 |
| 4828 } // namespace interpreter | 4828 } // namespace interpreter |
| 4829 } // namespace internal | 4829 } // namespace internal |
| 4830 } // namespace v8 | 4830 } // namespace v8 |
| OLD | NEW |