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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/interpreter/bytecode-array-iterator.h" | 8 #include "src/interpreter/bytecode-array-iterator.h" |
9 #include "src/interpreter/bytecode-generator.h" | 9 #include "src/interpreter/bytecode-generator.h" |
10 #include "src/interpreter/interpreter.h" | 10 #include "src/interpreter/interpreter.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); | 385 helper.MakeBytecodeForFunctionBody(snippets[i].code_snippet); |
386 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 386 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 | 390 |
391 TEST(PropertyLoads) { | 391 TEST(PropertyLoads) { |
392 InitializedHandleScope handle_scope; | 392 InitializedHandleScope handle_scope; |
393 BytecodeGeneratorHelper helper; | 393 BytecodeGeneratorHelper helper; |
394 | 394 |
395 Code::Kind ic_kinds[] = { i::Code::LOAD_IC, i::Code::LOAD_IC }; | 395 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC, |
| 396 i::FeedbackVectorSlotKind::LOAD_IC}; |
396 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 397 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); |
397 Handle<i::TypeFeedbackVector> vector = | 398 Handle<i::TypeFeedbackVector> vector = |
398 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 399 helper.factory()->NewTypeFeedbackVector(&feedback_spec); |
399 | 400 |
400 ExpectedSnippet<const char*> snippets[] = { | 401 ExpectedSnippet<const char*> snippets[] = { |
401 {"function f(a) { return a.name; }\nf({name : \"test\"})", | 402 {"function f(a) { return a.name; }\nf({name : \"test\"})", |
402 1 * kPointerSize, | 403 1 * kPointerSize, |
403 2, | 404 2, |
404 10, | 405 10, |
405 { | 406 { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 helper.MakeBytecode(snippets[i].code_snippet, "f"); | 473 helper.MakeBytecode(snippets[i].code_snippet, "f"); |
473 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 474 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
474 } | 475 } |
475 } | 476 } |
476 | 477 |
477 | 478 |
478 TEST(PropertyStores) { | 479 TEST(PropertyStores) { |
479 InitializedHandleScope handle_scope; | 480 InitializedHandleScope handle_scope; |
480 BytecodeGeneratorHelper helper; | 481 BytecodeGeneratorHelper helper; |
481 | 482 |
482 Code::Kind ic_kinds[] = { i::Code::STORE_IC, i::Code::STORE_IC }; | 483 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::STORE_IC, |
| 484 i::FeedbackVectorSlotKind::STORE_IC}; |
483 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 485 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); |
484 Handle<i::TypeFeedbackVector> vector = | 486 Handle<i::TypeFeedbackVector> vector = |
485 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 487 helper.factory()->NewTypeFeedbackVector(&feedback_spec); |
486 | 488 |
487 ExpectedSnippet<const char*> snippets[] = { | 489 ExpectedSnippet<const char*> snippets[] = { |
488 {"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})", | 490 {"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})", |
489 2 * kPointerSize, | 491 2 * kPointerSize, |
490 2, | 492 2, |
491 16, | 493 16, |
492 { | 494 { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 } | 579 } |
578 | 580 |
579 | 581 |
580 #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" | 582 #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" |
581 | 583 |
582 | 584 |
583 TEST(PropertyCall) { | 585 TEST(PropertyCall) { |
584 InitializedHandleScope handle_scope; | 586 InitializedHandleScope handle_scope; |
585 BytecodeGeneratorHelper helper; // | 587 BytecodeGeneratorHelper helper; // |
586 | 588 |
587 Code::Kind ic_kinds[] = { i::Code::LOAD_IC, i::Code::LOAD_IC }; | 589 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC, |
| 590 i::FeedbackVectorSlotKind::LOAD_IC}; |
588 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 591 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); |
589 Handle<i::TypeFeedbackVector> vector = | 592 Handle<i::TypeFeedbackVector> vector = |
590 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 593 helper.factory()->NewTypeFeedbackVector(&feedback_spec); |
591 | 594 |
592 ExpectedSnippet<const char*> snippets[] = { | 595 ExpectedSnippet<const char*> snippets[] = { |
593 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", | 596 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", |
594 2 * kPointerSize, | 597 2 * kPointerSize, |
595 2, | 598 2, |
596 16, | 599 16, |
597 { | 600 { |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 Handle<BytecodeArray> bytecode_array = | 874 Handle<BytecodeArray> bytecode_array = |
872 helper.MakeBytecodeForFunction(snippets[i].code_snippet); | 875 helper.MakeBytecodeForFunction(snippets[i].code_snippet); |
873 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 876 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
874 } | 877 } |
875 } | 878 } |
876 | 879 |
877 | 880 |
878 } // namespace interpreter | 881 } // namespace interpreter |
879 } // namespace internal | 882 } // namespace internal |
880 } // namespance v8 | 883 } // namespance v8 |
OLD | NEW |