OLD | NEW |
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/ic/handler-compiler.h" | 7 #include "src/ic/handler-compiler.h" |
8 #include "src/ic/ic-inl.h" | 8 #include "src/ic/ic-inl.h" |
9 #include "src/ic/ic-compiler.h" | 9 #include "src/ic/ic-compiler.h" |
10 | 10 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 receiver_map->instance_type() == JS_ARRAY_TYPE, | 126 receiver_map->instance_type() == JS_ARRAY_TYPE, |
127 elements_kind).GetCode(); | 127 elements_kind).GetCode(); |
128 } else { | 128 } else { |
129 stub = LoadDictionaryElementStub(isolate).GetCode(); | 129 stub = LoadDictionaryElementStub(isolate).GetCode(); |
130 } | 130 } |
131 return stub; | 131 return stub; |
132 } | 132 } |
133 | 133 |
134 | 134 |
135 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic( | 135 Handle<Code> PropertyICCompiler::ComputeKeyedStoreMonomorphic( |
136 Handle<Map> receiver_map, StrictMode strict_mode, | 136 Handle<Map> receiver_map, LanguageMode language_mode, |
137 KeyedAccessStoreMode store_mode) { | 137 KeyedAccessStoreMode store_mode) { |
138 Isolate* isolate = receiver_map->GetIsolate(); | 138 Isolate* isolate = receiver_map->GetIsolate(); |
139 ExtraICState extra_state = | 139 ExtraICState extra_state = |
140 KeyedStoreIC::ComputeExtraICState(strict_mode, store_mode); | 140 KeyedStoreIC::ComputeExtraICState(language_mode, store_mode); |
141 Code::Flags flags = | 141 Code::Flags flags = |
142 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, extra_state); | 142 Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, extra_state); |
143 | 143 |
144 DCHECK(store_mode == STANDARD_STORE || | 144 DCHECK(store_mode == STANDARD_STORE || |
145 store_mode == STORE_AND_GROW_NO_TRANSITION || | 145 store_mode == STORE_AND_GROW_NO_TRANSITION || |
146 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || | 146 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
147 store_mode == STORE_NO_TRANSITION_HANDLE_COW); | 147 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
148 | 148 |
149 Handle<String> name = isolate->factory()->KeyedStoreMonomorphic_string(); | 149 Handle<String> name = isolate->factory()->KeyedStoreMonomorphic_string(); |
150 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate); | 150 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 Handle<Code> handler = handlers->at(0); | 292 Handle<Code> handler = handlers->at(0); |
293 Code::StubType type = valid_types == 1 ? handler->type() : Code::NORMAL; | 293 Code::StubType type = valid_types == 1 ? handler->type() : Code::NORMAL; |
294 DCHECK(kind == Code::LOAD_IC || kind == Code::STORE_IC); | 294 DCHECK(kind == Code::LOAD_IC || kind == Code::STORE_IC); |
295 PropertyICCompiler ic_compiler(name->GetIsolate(), kind, extra_ic_state); | 295 PropertyICCompiler ic_compiler(name->GetIsolate(), kind, extra_ic_state); |
296 return ic_compiler.CompilePolymorphic(types, handlers, name, type, PROPERTY); | 296 return ic_compiler.CompilePolymorphic(types, handlers, name, type, PROPERTY); |
297 } | 297 } |
298 | 298 |
299 | 299 |
300 Handle<Code> PropertyICCompiler::ComputeKeyedStorePolymorphic( | 300 Handle<Code> PropertyICCompiler::ComputeKeyedStorePolymorphic( |
301 MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode, | 301 MapHandleList* receiver_maps, KeyedAccessStoreMode store_mode, |
302 StrictMode strict_mode) { | 302 LanguageMode language_mode) { |
303 Isolate* isolate = receiver_maps->at(0)->GetIsolate(); | 303 Isolate* isolate = receiver_maps->at(0)->GetIsolate(); |
304 DCHECK(store_mode == STANDARD_STORE || | 304 DCHECK(store_mode == STANDARD_STORE || |
305 store_mode == STORE_AND_GROW_NO_TRANSITION || | 305 store_mode == STORE_AND_GROW_NO_TRANSITION || |
306 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || | 306 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
307 store_mode == STORE_NO_TRANSITION_HANDLE_COW); | 307 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
308 Handle<PolymorphicCodeCache> cache = | 308 Handle<PolymorphicCodeCache> cache = |
309 isolate->factory()->polymorphic_code_cache(); | 309 isolate->factory()->polymorphic_code_cache(); |
310 ExtraICState extra_state = | 310 ExtraICState extra_state = |
311 KeyedStoreIC::ComputeExtraICState(strict_mode, store_mode); | 311 KeyedStoreIC::ComputeExtraICState(language_mode, store_mode); |
312 Code::Flags flags = | 312 Code::Flags flags = |
313 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); | 313 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); |
314 Handle<Object> probe = cache->Lookup(receiver_maps, flags); | 314 Handle<Object> probe = cache->Lookup(receiver_maps, flags); |
315 if (probe->IsCode()) return Handle<Code>::cast(probe); | 315 if (probe->IsCode()) return Handle<Code>::cast(probe); |
316 | 316 |
317 PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state); | 317 PropertyICCompiler compiler(isolate, Code::KEYED_STORE_IC, extra_state); |
318 Handle<Code> code = | 318 Handle<Code> code = |
319 compiler.CompileKeyedStorePolymorphic(receiver_maps, store_mode); | 319 compiler.CompileKeyedStorePolymorphic(receiver_maps, store_mode); |
320 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); | 320 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); |
321 return code; | 321 return code; |
(...skipping 29 matching lines...) Expand all Loading... |
351 StoreIC::GeneratePreMonomorphic(masm()); | 351 StoreIC::GeneratePreMonomorphic(masm()); |
352 Handle<Code> code = GetCodeWithFlags(flags, "CompileStorePreMonomorphic"); | 352 Handle<Code> code = GetCodeWithFlags(flags, "CompileStorePreMonomorphic"); |
353 PROFILE(isolate(), | 353 PROFILE(isolate(), |
354 CodeCreateEvent(Logger::STORE_PREMONOMORPHIC_TAG, *code, 0)); | 354 CodeCreateEvent(Logger::STORE_PREMONOMORPHIC_TAG, *code, 0)); |
355 return code; | 355 return code; |
356 } | 356 } |
357 | 357 |
358 | 358 |
359 Handle<Code> PropertyICCompiler::CompileStoreGeneric(Code::Flags flags) { | 359 Handle<Code> PropertyICCompiler::CompileStoreGeneric(Code::Flags flags) { |
360 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 360 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
361 StrictMode strict_mode = StoreIC::GetStrictMode(extra_state); | 361 LanguageMode language_mode = StoreIC::GetLanguageMode(extra_state); |
362 GenerateRuntimeSetProperty(masm(), strict_mode); | 362 GenerateRuntimeSetProperty(masm(), language_mode); |
363 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric"); | 363 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreGeneric"); |
364 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0)); | 364 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_GENERIC_TAG, *code, 0)); |
365 return code; | 365 return code; |
366 } | 366 } |
367 | 367 |
368 | 368 |
369 Handle<Code> PropertyICCompiler::CompileStoreMegamorphic(Code::Flags flags) { | 369 Handle<Code> PropertyICCompiler::CompileStoreMegamorphic(Code::Flags flags) { |
370 StoreIC::GenerateMegamorphic(masm()); | 370 StoreIC::GenerateMegamorphic(masm()); |
371 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic"); | 371 Handle<Code> code = GetCodeWithFlags(flags, "CompileStoreMegamorphic"); |
372 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG, *code, 0)); | 372 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_MEGAMORPHIC_TAG, *code, 0)); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 | 460 |
461 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 461 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
462 | 462 |
463 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); | 463 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); |
464 } | 464 } |
465 | 465 |
466 | 466 |
467 #undef __ | 467 #undef __ |
468 } | 468 } |
469 } // namespace v8::internal | 469 } // namespace v8::internal |
OLD | NEW |