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

Side by Side Diff: src/code-stubs.h

Issue 965723002: Ensure we can reliably check the cell for validity of global property (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_CODE_STUBS_H_ 5 #ifndef V8_CODE_STUBS_H_
6 #define V8_CODE_STUBS_H_ 6 #define V8_CODE_STUBS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assembler.h" 9 #include "src/assembler.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global) 1113 StoreGlobalStub(Isolate* isolate, bool is_constant, bool check_global)
1114 : HandlerStub(isolate) { 1114 : HandlerStub(isolate) {
1115 set_sub_minor_key(IsConstantBits::encode(is_constant) | 1115 set_sub_minor_key(IsConstantBits::encode(is_constant) |
1116 CheckGlobalBits::encode(check_global)); 1116 CheckGlobalBits::encode(check_global));
1117 } 1117 }
1118 1118
1119 static Handle<HeapObject> property_cell_placeholder(Isolate* isolate) { 1119 static Handle<HeapObject> property_cell_placeholder(Isolate* isolate) {
1120 return isolate->factory()->uninitialized_value(); 1120 return isolate->factory()->uninitialized_value();
1121 } 1121 }
1122 1122
1123 Handle<Code> GetCodeCopyFromTemplate(Handle<GlobalObject> global, 1123 Handle<Code> GetCodeCopyFromTemplate(Handle<PropertyCell> cell) {
1124 Handle<PropertyCell> cell) { 1124 Code::FindAndReplacePattern pattern;
1125 if (check_global()) { 1125 pattern.Add(Handle<Map>(property_cell_placeholder(isolate())->map()),
1126 Code::FindAndReplacePattern pattern; 1126 isolate()->factory()->NewWeakCell(cell));
1127 pattern.Add(isolate()->factory()->meta_map(), 1127 return CodeStub::GetCodeCopy(pattern);
1128 Map::WeakCellForMap(Handle<Map>(global->map())));
1129 pattern.Add(Handle<Map>(property_cell_placeholder(isolate())->map()),
1130 isolate()->factory()->NewWeakCell(cell));
1131 return CodeStub::GetCodeCopy(pattern);
1132 } else {
1133 Code::FindAndReplacePattern pattern;
1134 pattern.Add(Handle<Map>(property_cell_placeholder(isolate())->map()),
1135 isolate()->factory()->NewWeakCell(cell));
1136 return CodeStub::GetCodeCopy(pattern);
1137 }
1138 } 1128 }
1139 1129
1140 Code::Kind kind() const OVERRIDE { return Code::STORE_IC; } 1130 Code::Kind kind() const OVERRIDE { return Code::STORE_IC; }
1141 1131
1142 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); } 1132 bool is_constant() const { return IsConstantBits::decode(sub_minor_key()); }
1143 1133
1144 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); } 1134 bool check_global() const { return CheckGlobalBits::decode(sub_minor_key()); }
1145 1135
1146 void set_is_constant(bool value) { 1136 void set_is_constant(bool value) {
1147 set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value)); 1137 set_sub_minor_key(IsConstantBits::update(sub_minor_key(), value));
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after
2732 2722
2733 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR 2723 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR
2734 #undef DEFINE_PLATFORM_CODE_STUB 2724 #undef DEFINE_PLATFORM_CODE_STUB
2735 #undef DEFINE_HANDLER_CODE_STUB 2725 #undef DEFINE_HANDLER_CODE_STUB
2736 #undef DEFINE_HYDROGEN_CODE_STUB 2726 #undef DEFINE_HYDROGEN_CODE_STUB
2737 #undef DEFINE_CODE_STUB 2727 #undef DEFINE_CODE_STUB
2738 #undef DEFINE_CODE_STUB_BASE 2728 #undef DEFINE_CODE_STUB_BASE
2739 } } // namespace v8::internal 2729 } } // namespace v8::internal
2740 2730
2741 #endif // V8_CODE_STUBS_H_ 2731 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « no previous file | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698