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/ic/ic-compiler.cc

Issue 1189153002: Revert of [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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, ExtraICState extra_ic_state) { 91 Handle<Map> receiver_map) {
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 !(is_strong(LoadICState::GetLanguageMode(extra_ic_state))); 101
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, LoadICState(extra_ic_state)) 116 stub = LoadDictionaryElementStub(isolate).GetCode();
117 .GetCode();
118 } 117 }
119 return stub; 118 return stub;
120 } 119 }
121 120
122 121
123 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic( 122 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic(
124 Handle<Map> receiver_map, LanguageMode language_mode, 123 Handle<Map> receiver_map, LanguageMode language_mode,
125 KeyedAccessStoreMode store_mode) { 124 KeyedAccessStoreMode store_mode) {
126 Isolate* isolate = receiver_map->GetIsolate(); 125 Isolate* isolate = receiver_map->GetIsolate();
127 ExtraICState extra_state = 126 ExtraICState extra_state =
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 214
216 if (!receiver_map->is_dictionary_map()) { 215 if (!receiver_map->is_dictionary_map()) {
217 Map::UpdateCodeCache(receiver_map, name, ic); 216 Map::UpdateCodeCache(receiver_map, name, ic);
218 } 217 }
219 218
220 return ic; 219 return ic;
221 } 220 }
222 221
223 222
224 Handle<Code> PropertyICCompiler::ComputeKeyedLoadPolymorphic( 223 Handle<Code> PropertyICCompiler::ComputeKeyedLoadPolymorphic(
225 MapHandleList* receiver_maps, LanguageMode language_mode) { 224 MapHandleList* receiver_maps) {
226 Isolate* isolate = receiver_maps->at(0)->GetIsolate(); 225 Isolate* isolate = receiver_maps->at(0)->GetIsolate();
227 DCHECK(KeyedLoadIC::GetKeyType(kNoExtraICState) == ELEMENT); 226 DCHECK(KeyedLoadIC::GetKeyType(kNoExtraICState) == ELEMENT);
228 Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC); 227 Code::Flags flags = Code::ComputeFlags(Code::KEYED_LOAD_IC, POLYMORPHIC);
229 Handle<PolymorphicCodeCache> cache = 228 Handle<PolymorphicCodeCache> cache =
230 isolate->factory()->polymorphic_code_cache(); 229 isolate->factory()->polymorphic_code_cache();
231 Handle<Object> probe = cache->Lookup(receiver_maps, flags); 230 Handle<Object> probe = cache->Lookup(receiver_maps, flags);
232 if (probe->IsCode()) return Handle<Code>::cast(probe); 231 if (probe->IsCode()) return Handle<Code>::cast(probe);
233 232
234 CodeHandleList handlers(receiver_maps->length()); 233 CodeHandleList handlers(receiver_maps->length());
235 ElementHandlerCompiler compiler(isolate); 234 ElementHandlerCompiler compiler(isolate);
236 compiler.CompileElementHandlers(receiver_maps, &handlers, language_mode); 235 compiler.CompileElementHandlers(receiver_maps, &handlers);
237 PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC); 236 PropertyICCompiler ic_compiler(isolate, Code::KEYED_LOAD_IC);
238 Handle<Code> code = ic_compiler.CompilePolymorphic( 237 Handle<Code> code = ic_compiler.CompilePolymorphic(
239 receiver_maps, &handlers, isolate->factory()->empty_string(), 238 receiver_maps, &handlers, isolate->factory()->empty_string(),
240 Code::NORMAL, ELEMENT); 239 Code::NORMAL, ELEMENT);
241 240
242 isolate->counters()->keyed_load_polymorphic_stubs()->Increment(); 241 isolate->counters()->keyed_load_polymorphic_stubs()->Increment();
243 242
244 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); 243 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code);
245 return code; 244 return code;
246 } 245 }
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 414
416 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); 415 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss);
417 416
418 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); 417 return GetCode(kind(), Code::NORMAL, factory()->empty_string());
419 } 418 }
420 419
421 420
422 #undef __ 421 #undef __
423 } // namespace internal 422 } // namespace internal
424 } // namespace v8 423 } // 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