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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 Code::Kind kind, Handle<Name> name, Handle<HeapType> type, | 50 Code::Kind kind, Handle<Name> name, Handle<HeapType> type, |
51 Handle<Code> handler, ExtraICState extra_ic_state) { | 51 Handle<Code> handler, ExtraICState extra_ic_state) { |
52 Isolate* isolate = name->GetIsolate(); | 52 Isolate* isolate = name->GetIsolate(); |
53 if (handler.is_identical_to(isolate->builtins()->LoadIC_Normal()) || | 53 if (handler.is_identical_to(isolate->builtins()->LoadIC_Normal()) || |
54 handler.is_identical_to(isolate->builtins()->StoreIC_Normal())) { | 54 handler.is_identical_to(isolate->builtins()->StoreIC_Normal())) { |
55 name = isolate->factory()->normal_ic_symbol(); | 55 name = isolate->factory()->normal_ic_symbol(); |
56 } | 56 } |
57 | 57 |
58 CacheHolderFlag flag; | 58 CacheHolderFlag flag; |
59 Handle<Map> stub_holder = IC::GetICCacheHolder(*type, isolate, &flag); | 59 Handle<Map> stub_holder = IC::GetICCacheHolder(*type, isolate, &flag); |
| 60 if (kind == Code::KEYED_STORE_IC) { |
| 61 // Always set the "property" bit. |
| 62 extra_ic_state = |
| 63 KeyedStoreIC::IcCheckTypeField::update(extra_ic_state, PROPERTY); |
| 64 DCHECK(STANDARD_STORE == |
| 65 KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state)); |
| 66 } |
60 | 67 |
61 Handle<Code> ic; | 68 Handle<Code> ic; |
62 // There are multiple string maps that all use the same prototype. That | 69 // There are multiple string maps that all use the same prototype. That |
63 // prototype cannot hold multiple handlers, one for each of the string maps, | 70 // prototype cannot hold multiple handlers, one for each of the string maps, |
64 // for a single name. Hence, turn off caching of the IC. | 71 // for a single name. Hence, turn off caching of the IC. |
65 bool can_be_cached = !type->Is(HeapType::String()); | 72 bool can_be_cached = !type->Is(HeapType::String()); |
66 if (can_be_cached) { | 73 if (can_be_cached) { |
67 ic = Find(name, stub_holder, kind, extra_ic_state, flag); | 74 ic = Find(name, stub_holder, kind, extra_ic_state, flag); |
68 if (!ic.is_null()) return ic; | 75 if (!ic.is_null()) return ic; |
69 } | 76 } |
70 | 77 |
71 #ifdef DEBUG | |
72 if (kind == Code::KEYED_STORE_IC) { | |
73 DCHECK(STANDARD_STORE == | |
74 KeyedStoreIC::GetKeyedAccessStoreMode(extra_ic_state)); | |
75 } | |
76 #endif | |
77 | |
78 PropertyICCompiler ic_compiler(isolate, kind, extra_ic_state, flag); | 78 PropertyICCompiler ic_compiler(isolate, kind, extra_ic_state, flag); |
79 ic = ic_compiler.CompileMonomorphic(type, handler, name, PROPERTY); | 79 ic = ic_compiler.CompileMonomorphic(type, handler, name, PROPERTY); |
80 | 80 |
81 if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic); | 81 if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic); |
82 return ic; | 82 return ic; |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphic( | 86 Handle<Code> PropertyICCompiler::ComputeKeyedLoadMonomorphic( |
87 Handle<Map> receiver_map) { | 87 Handle<Map> receiver_map) { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 438 |
439 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); | 439 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss); |
440 | 440 |
441 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); | 441 return GetCode(kind(), Code::NORMAL, factory()->empty_string()); |
442 } | 442 } |
443 | 443 |
444 | 444 |
445 #undef __ | 445 #undef __ |
446 } | 446 } |
447 } // namespace v8::internal | 447 } // namespace v8::internal |
OLD | NEW |