Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Side by Side Diff: src/interpreter/bytecode-array-builder.cc

Issue 2676583002: [ic] Encode [Keyed]StoreIC's language mode in slot kind instead of code object's flags. (Closed)
Patch Set: Rebasing Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/interpreter/bytecode-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 #include "src/globals.h" 7 #include "src/globals.h"
8 #include "src/interpreter/bytecode-array-writer.h" 8 #include "src/interpreter/bytecode-array-writer.h"
9 #include "src/interpreter/bytecode-dead-code-optimizer.h" 9 #include "src/interpreter/bytecode-dead-code-optimizer.h"
10 #include "src/interpreter/bytecode-label.h" 10 #include "src/interpreter/bytecode-label.h"
11 #include "src/interpreter/bytecode-peephole-optimizer.h" 11 #include "src/interpreter/bytecode-peephole-optimizer.h"
12 #include "src/interpreter/bytecode-register-optimizer.h" 12 #include "src/interpreter/bytecode-register-optimizer.h"
13 #include "src/interpreter/interpreter-intrinsics.h" 13 #include "src/interpreter/interpreter-intrinsics.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 namespace interpreter { 17 namespace interpreter {
18 18
19 BytecodeArrayBuilder::BytecodeArrayBuilder( 19 BytecodeArrayBuilder::BytecodeArrayBuilder(
20 Isolate* isolate, Zone* zone, int parameter_count, int context_count, 20 Isolate* isolate, Zone* zone, int parameter_count, int context_count,
21 int locals_count, FunctionLiteral* literal, 21 int locals_count, FunctionLiteral* literal,
22 SourcePositionTableBuilder::RecordingMode source_position_mode) 22 SourcePositionTableBuilder::RecordingMode source_position_mode)
23 : zone_(zone), 23 : zone_(zone),
24 literal_(literal),
24 bytecode_generated_(false), 25 bytecode_generated_(false),
25 constant_array_builder_(zone, isolate->factory()->the_hole_value()), 26 constant_array_builder_(zone, isolate->factory()->the_hole_value()),
26 handler_table_builder_(zone), 27 handler_table_builder_(zone),
27 return_seen_in_block_(false), 28 return_seen_in_block_(false),
28 parameter_count_(parameter_count), 29 parameter_count_(parameter_count),
29 local_register_count_(locals_count), 30 local_register_count_(locals_count),
30 context_register_count_(context_count), 31 context_register_count_(context_count),
31 register_allocator_(fixed_register_count()), 32 register_allocator_(fixed_register_count()),
32 bytecode_array_writer_(zone, &constant_array_builder_, 33 bytecode_array_writer_(zone, &constant_array_builder_,
33 source_position_mode), 34 source_position_mode),
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 Register object, Register name, DataPropertyInLiteralFlags flags, 558 Register object, Register name, DataPropertyInLiteralFlags flags,
558 int feedback_slot) { 559 int feedback_slot) {
559 OutputStaDataPropertyInLiteral(object, name, flags, feedback_slot); 560 OutputStaDataPropertyInLiteral(object, name, flags, feedback_slot);
560 return *this; 561 return *this;
561 } 562 }
562 563
563 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty( 564 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty(
564 Register object, const Handle<Name> name, int feedback_slot, 565 Register object, const Handle<Name> name, int feedback_slot,
565 LanguageMode language_mode) { 566 LanguageMode language_mode) {
566 size_t name_index = GetConstantPoolEntry(name); 567 size_t name_index = GetConstantPoolEntry(name);
568 // Ensure that language mode is in sync with the IC slot kind if the function
569 // literal is available (not a unit test case).
570 // TODO(ishell): check only in debug mode.
571 if (literal_) {
572 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(feedback_slot);
573 CHECK_EQ(GetLanguageModeFromICKind(feedback_vector_spec()->GetKind(slot)),
574 language_mode);
575 }
567 if (language_mode == SLOPPY) { 576 if (language_mode == SLOPPY) {
568 OutputStaNamedPropertySloppy(object, name_index, feedback_slot); 577 OutputStaNamedPropertySloppy(object, name_index, feedback_slot);
569 } else { 578 } else {
570 DCHECK_EQ(language_mode, STRICT); 579 DCHECK_EQ(language_mode, STRICT);
571 OutputStaNamedPropertyStrict(object, name_index, feedback_slot); 580 OutputStaNamedPropertyStrict(object, name_index, feedback_slot);
572 } 581 }
573 return *this; 582 return *this;
574 } 583 }
575 584
576 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty( 585 BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
577 Register object, Register key, int feedback_slot, 586 Register object, Register key, int feedback_slot,
578 LanguageMode language_mode) { 587 LanguageMode language_mode) {
588 // Ensure that language mode is in sync with the IC slot kind if the function
589 // literal is available (not a unit test case).
590 // TODO(ishell): check only in debug mode.
591 if (literal_) {
592 FeedbackVectorSlot slot = TypeFeedbackVector::ToSlot(feedback_slot);
593 CHECK_EQ(GetLanguageModeFromICKind(feedback_vector_spec()->GetKind(slot)),
594 language_mode);
595 }
579 if (language_mode == SLOPPY) { 596 if (language_mode == SLOPPY) {
580 OutputStaKeyedPropertySloppy(object, key, feedback_slot); 597 OutputStaKeyedPropertySloppy(object, key, feedback_slot);
581 } else { 598 } else {
582 DCHECK_EQ(language_mode, STRICT); 599 DCHECK_EQ(language_mode, STRICT);
583 OutputStaKeyedPropertyStrict(object, key, feedback_slot); 600 OutputStaKeyedPropertyStrict(object, key, feedback_slot);
584 } 601 }
585 return *this; 602 return *this;
586 } 603 }
587 604
588 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateClosure( 605 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateClosure(
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 RegisterList reg_list) { 1075 RegisterList reg_list) {
1059 DCHECK(RegisterListIsValid(reg_list)); 1076 DCHECK(RegisterListIsValid(reg_list));
1060 if (register_optimizer_) 1077 if (register_optimizer_)
1061 register_optimizer_->PrepareOutputRegisterList(reg_list); 1078 register_optimizer_->PrepareOutputRegisterList(reg_list);
1062 return static_cast<uint32_t>(reg_list.first_register().ToOperand()); 1079 return static_cast<uint32_t>(reg_list.first_register().ToOperand());
1063 } 1080 }
1064 1081
1065 } // namespace interpreter 1082 } // namespace interpreter
1066 } // namespace internal 1083 } // namespace internal
1067 } // namespace v8 1084 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698