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

Side by Side Diff: src/ic/ic-compiler.cc

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 6 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 | « src/ic/ic-compiler.h ('k') | src/ic/ic-inl.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/cpu-profiler.h" 7 #include "src/cpu-profiler.h"
8 #include "src/ic/handler-compiler.h" 8 #include "src/ic/handler-compiler.h"
9 #include "src/ic/ic-inl.h" 9 #include "src/ic/ic-inl.h"
10 #include "src/ic/ic-compiler.h" 10 #include "src/ic/ic-compiler.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 PropertyICCompiler ic_compiler(isolate, kind, extra_ic_state, flag); 82 PropertyICCompiler ic_compiler(isolate, kind, extra_ic_state, flag);
83 ic = ic_compiler.CompileMonomorphic(map, handler, name, PROPERTY); 83 ic = ic_compiler.CompileMonomorphic(map, handler, name, PROPERTY);
84 84
85 if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic); 85 if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic);
86 return ic; 86 return ic;
87 } 87 }
88 88
89 89
90 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler( 90 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphicHandler(
91 Handle<Map> receiver_map) { 91 Handle<Map> receiver_map, ExtraICState extra_ic_state) {
92 Isolate* isolate = receiver_map->GetIsolate(); 92 Isolate* isolate = receiver_map->GetIsolate();
93 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE; 93 bool is_js_array = receiver_map->instance_type() == JS_ARRAY_TYPE;
94 ElementsKind elements_kind = receiver_map->elements_kind(); 94 ElementsKind elements_kind = receiver_map->elements_kind();
95 95
96 // No need to check for an elements-free prototype chain here, the generated 96 // No need to check for an elements-free prototype chain here, the generated
97 // stub code needs to check that dynamically anyway. 97 // stub code needs to check that dynamically anyway.
98 bool convert_hole_to_undefined = 98 bool convert_hole_to_undefined =
99 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS && 99 is_js_array && elements_kind == FAST_HOLEY_ELEMENTS &&
100 *receiver_map == isolate->get_initial_js_array_map(elements_kind); 100 *receiver_map == isolate->get_initial_js_array_map(elements_kind) &&
101 101 !(is_strong(LoadICState::GetLanguageMode(extra_ic_state)));
102 Handle<Code> stub; 102 Handle<Code> stub;
103 if (receiver_map->has_indexed_interceptor()) { 103 if (receiver_map->has_indexed_interceptor()) {
104 stub = LoadIndexedInterceptorStub(isolate).GetCode(); 104 stub = LoadIndexedInterceptorStub(isolate).GetCode();
105 } else if (receiver_map->IsStringMap()) { 105 } else if (receiver_map->IsStringMap()) {
106 // We have a string. 106 // We have a string.
107 stub = LoadIndexedStringStub(isolate).GetCode(); 107 stub = LoadIndexedStringStub(isolate).GetCode();
108 } else if (receiver_map->has_sloppy_arguments_elements()) { 108 } else if (receiver_map->has_sloppy_arguments_elements()) {
109 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode(); 109 stub = KeyedLoadSloppyArgumentsStub(isolate).GetCode();
110 } else if (receiver_map->has_fast_elements() || 110 } else if (receiver_map->has_fast_elements() ||
111 receiver_map->has_external_array_elements() || 111 receiver_map->has_external_array_elements() ||
112 receiver_map->has_fixed_typed_array_elements()) { 112 receiver_map->has_fixed_typed_array_elements()) {
113 stub = LoadFastElementStub(isolate, is_js_array, elements_kind, 113 stub = LoadFastElementStub(isolate, is_js_array, elements_kind,
114 convert_hole_to_undefined).GetCode(); 114 convert_hole_to_undefined).GetCode();
115 } else { 115 } else {
116 stub = LoadDictionaryElementStub(isolate).GetCode(); 116 stub = LoadDictionaryElementStub(isolate, LoadICState(extra_ic_state))
117 .GetCode();
117 } 118 }
118 return stub; 119 return stub;
119 } 120 }
120 121
121 122
122 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic( 123 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic(
123 Handle<Map> receiver_map, LanguageMode language_mode, 124 Handle<Map> receiver_map, LanguageMode language_mode,
124 KeyedAccessStoreMode store_mode) { 125 KeyedAccessStoreMode store_mode) {
125 Isolate* isolate = receiver_map->GetIsolate(); 126 Isolate* isolate = receiver_map->GetIsolate();
126 ExtraICState extra_state = 127 ExtraICState extra_state =
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 215
215 if (!receiver_map->is_dictionary_map()) { 216 if (!receiver_map->is_dictionary_map()) {
216 Map::UpdateCodeCache(receiver_map, name, ic); 217 Map::UpdateCodeCache(receiver_map, name, ic);
217 } 218 }
218 219
219 return ic; 220 return ic;
220 } 221 }
221 222
222 223
223 Handle<Code> PropertyICCompiler::ComputeKeyedLoadPolymorphic( 224 Handle<Code> PropertyICCompiler::ComputeKeyedLoadPolymorphic(
224 MapHandleList* receiver_maps) { 225 MapHandleList* receiver_maps, LanguageMode language_mode) {
225 Isolate* isolate = receiver_maps->at(0)->GetIsolate(); 226 Isolate* isolate = receiver_maps->at(0)->GetIsolate();
226 DCHECK(KeyedLoadIC::GetKeyType(kNoExtraICState) == ELEMENT); 227 DCHECK(KeyedLoadIC::GetKeyType(kNoExtraICState) == ELEMENT);
227 Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC); 228 Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC);
228 Handle<PolymorphicCodeCache> cache = 229 Handle<PolymorphicCodeCache> cache =
229 isolate->factory()->polymorphic_code_cache(); 230 isolate->factory()->polymorphic_code_cache();
230 Handle<Object> probe = cache->Lookup(receiver_maps, flags); 231 Handle<Object> probe = cache->Lookup(receiver_maps, flags);
231 if (probe->IsCode()) return Handle<Code>::cast(probe); 232 if (probe->IsCode()) return Handle<Code>::cast(probe);
232 233
233 CodeHandleList handlers(receiver_maps->length()); 234 CodeHandleList handlers(receiver_maps->length());
234 ElementHandlerCompiler compiler(isolate); 235 ElementHandlerCompiler compiler(isolate);
235 compiler.CompileElementHandlers(receiver_maps, &handlers); 236 compiler.CompileElementHandlers(receiver_maps, &handlers, language_mode);
236 PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC); 237 PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC);
237 Handle<Code> code = ic_compiler.CompilePolymorphic( 238 Handle<Code> code = ic_compiler.CompilePolymorphic(
238 receiver_maps, &handlers, isolate->factory()->empty_string(), 239 receiver_maps, &handlers, isolate->factory()->empty_string(),
239 Code::NORMAL, ELEMENT); 240 Code::NORMAL, ELEMENT);
240 241
241 isolate->counters()->keyed_load_polymorphic_stubs()->Increment(); 242 isolate->counters()->keyed_load_polymorphic_stubs()->Increment();
242 243
243 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); 244 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
244 return code; 245 return code;
245 } 246 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 415
415 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); 416 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss);
416 417
417 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); 418 return GetCode(kind(), Code::NORMAL, factory()->empty_string());
418 } 419 }
419 420
420 421
421 #undef __ 422 #undef __
422 } // namespace internal 423 } // namespace internal
423 } // namespace v8 424 } // namespace v8
OLDNEW
« no previous file with comments | « src/ic/ic-compiler.h ('k') | src/ic/ic-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698