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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC, | 395 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC, |
396 i::FeedbackVectorSlotKind::LOAD_IC}; | 396 i::FeedbackVectorSlotKind::LOAD_IC}; |
397 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 397 StaticFeedbackVectorSpec feedback_spec(0, 2, ic_kinds); |
398 Handle<i::TypeFeedbackVector> vector = | 398 Handle<i::TypeFeedbackVector> vector = |
399 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 399 helper.factory()->NewTypeFeedbackVector(&feedback_spec); |
400 | 400 |
401 ExpectedSnippet<const char*> snippets[] = { | 401 ExpectedSnippet<const char*> snippets[] = { |
402 {"function f(a) { return a.name; }\nf({name : \"test\"})", | 402 {"function f(a) { return a.name; }\nf({name : \"test\"})", |
403 1 * kPointerSize, | 403 1 * kPointerSize, |
404 2, | 404 2, |
405 10, | 405 10, |
406 { | 406 { |
407 B(Ldar), R(helper.kLastParamIndex), // | 407 B(Ldar), R(helper.kLastParamIndex), // |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 475 } |
476 } | 476 } |
477 | 477 |
478 | 478 |
479 TEST(PropertyStores) { | 479 TEST(PropertyStores) { |
480 InitializedHandleScope handle_scope; | 480 InitializedHandleScope handle_scope; |
481 BytecodeGeneratorHelper helper; | 481 BytecodeGeneratorHelper helper; |
482 | 482 |
483 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::STORE_IC, | 483 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::STORE_IC, |
484 i::FeedbackVectorSlotKind::STORE_IC}; | 484 i::FeedbackVectorSlotKind::STORE_IC}; |
485 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 485 StaticFeedbackVectorSpec feedback_spec(0, 2, ic_kinds); |
486 Handle<i::TypeFeedbackVector> vector = | 486 Handle<i::TypeFeedbackVector> vector = |
487 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 487 helper.factory()->NewTypeFeedbackVector(&feedback_spec); |
488 | 488 |
489 ExpectedSnippet<const char*> snippets[] = { | 489 ExpectedSnippet<const char*> snippets[] = { |
490 {"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})", | 490 {"function f(a) { a.name = \"val\"; }\nf({name : \"test\"})", |
491 2 * kPointerSize, | 491 2 * kPointerSize, |
492 2, | 492 2, |
493 16, | 493 16, |
494 { | 494 { |
495 B(Ldar), R(helper.kLastParamIndex), // | 495 B(Ldar), R(helper.kLastParamIndex), // |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 581 |
582 #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" | 582 #define FUNC_ARG "new (function Obj() { this.func = function() { return; }})()" |
583 | 583 |
584 | 584 |
585 TEST(PropertyCall) { | 585 TEST(PropertyCall) { |
586 InitializedHandleScope handle_scope; | 586 InitializedHandleScope handle_scope; |
587 BytecodeGeneratorHelper helper; // | 587 BytecodeGeneratorHelper helper; // |
588 | 588 |
589 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC, | 589 FeedbackVectorSlotKind ic_kinds[] = {i::FeedbackVectorSlotKind::LOAD_IC, |
590 i::FeedbackVectorSlotKind::LOAD_IC}; | 590 i::FeedbackVectorSlotKind::LOAD_IC}; |
591 FeedbackVectorSpec feedback_spec(0, 2, ic_kinds); | 591 StaticFeedbackVectorSpec feedback_spec(0, 2, ic_kinds); |
592 Handle<i::TypeFeedbackVector> vector = | 592 Handle<i::TypeFeedbackVector> vector = |
593 helper.factory()->NewTypeFeedbackVector(&feedback_spec); | 593 helper.factory()->NewTypeFeedbackVector(&feedback_spec); |
594 | 594 |
595 ExpectedSnippet<const char*> snippets[] = { | 595 ExpectedSnippet<const char*> snippets[] = { |
596 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", | 596 {"function f(a) { return a.func(); }\nf(" FUNC_ARG ")", |
597 2 * kPointerSize, | 597 2 * kPointerSize, |
598 2, | 598 2, |
599 16, | 599 16, |
600 { | 600 { |
601 B(Ldar), R(helper.kLastParamIndex), // | 601 B(Ldar), R(helper.kLastParamIndex), // |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 Handle<BytecodeArray> bytecode_array = | 874 Handle<BytecodeArray> bytecode_array = |
875 helper.MakeBytecodeForFunction(snippets[i].code_snippet); | 875 helper.MakeBytecodeForFunction(snippets[i].code_snippet); |
876 CheckBytecodeArrayEqual(snippets[i], bytecode_array); | 876 CheckBytecodeArrayEqual(snippets[i], bytecode_array); |
877 } | 877 } |
878 } | 878 } |
879 | 879 |
880 | 880 |
881 } // namespace interpreter | 881 } // namespace interpreter |
882 } // namespace internal | 882 } // namespace internal |
883 } // namespance v8 | 883 } // namespance v8 |
OLD | NEW |