OLD | NEW |
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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
10 #include "src/hydrogen.h" | 10 #include "src/hydrogen.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 HValue* GetArgumentsLength() { | 55 HValue* GetArgumentsLength() { |
56 // This is initialized in BuildGraph() | 56 // This is initialized in BuildGraph() |
57 DCHECK(arguments_length_ != NULL); | 57 DCHECK(arguments_length_ != NULL); |
58 return arguments_length_; | 58 return arguments_length_; |
59 } | 59 } |
60 CompilationInfo* info() { return info_; } | 60 CompilationInfo* info() { return info_; } |
61 CodeStub* stub() { return info_->code_stub(); } | 61 CodeStub* stub() { return info_->code_stub(); } |
62 HContext* context() { return context_; } | 62 HContext* context() { return context_; } |
63 Isolate* isolate() { return info_->isolate(); } | 63 Isolate* isolate() { return info_->isolate(); } |
64 | 64 |
65 HLoadNamedField* BuildLoadNamedField(HValue* object, FieldIndex index); | 65 HLoadNamedField* BuildLoadNamedField(HValue* object, |
| 66 FieldIndex index); |
66 void BuildStoreNamedField(HValue* object, HValue* value, FieldIndex index, | 67 void BuildStoreNamedField(HValue* object, HValue* value, FieldIndex index, |
67 Representation representation, | 68 Representation representation, |
68 bool transition_to_field); | 69 bool transition_to_field); |
69 | 70 |
70 enum ArgumentClass { | 71 enum ArgumentClass { |
71 NONE, | 72 NONE, |
72 SINGLE, | 73 SINGLE, |
73 MULTIPLE | 74 MULTIPLE |
74 }; | 75 }; |
75 | 76 |
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1893 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { | 1894 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { |
1894 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); | 1895 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); |
1895 HValue* key = GetParameter(LoadDescriptor::kNameIndex); | 1896 HValue* key = GetParameter(LoadDescriptor::kNameIndex); |
1896 | 1897 |
1897 Add<HCheckSmi>(key); | 1898 Add<HCheckSmi>(key); |
1898 | 1899 |
1899 HValue* elements = AddLoadElements(receiver); | 1900 HValue* elements = AddLoadElements(receiver); |
1900 | 1901 |
1901 HValue* hash = BuildElementIndexHash(key); | 1902 HValue* hash = BuildElementIndexHash(key); |
1902 | 1903 |
1903 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash, | 1904 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash); |
1904 casted_stub()->language_mode()); | |
1905 } | 1905 } |
1906 | 1906 |
1907 | 1907 |
1908 Handle<Code> LoadDictionaryElementStub::GenerateCode() { | 1908 Handle<Code> LoadDictionaryElementStub::GenerateCode() { |
1909 return DoGenerateCode(this); | 1909 return DoGenerateCode(this); |
1910 } | 1910 } |
1911 | 1911 |
1912 | 1912 |
1913 template<> | 1913 template<> |
1914 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { | 1914 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, | 2008 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, |
2009 false, kind, | 2009 false, kind, |
2010 LOAD, NEVER_RETURN_HOLE, | 2010 LOAD, NEVER_RETURN_HOLE, |
2011 STANDARD_STORE)); | 2011 STANDARD_STORE)); |
2012 } | 2012 } |
2013 | 2013 |
2014 | 2014 |
2015 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { | 2015 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { |
2016 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); | 2016 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); |
2017 HValue* key = GetParameter(LoadDescriptor::kNameIndex); | 2017 HValue* key = GetParameter(LoadDescriptor::kNameIndex); |
| 2018 |
2018 // Split into a smi/integer case and unique string case. | 2019 // Split into a smi/integer case and unique string case. |
2019 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), | 2020 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), |
2020 graph()->CreateBasicBlock()); | 2021 graph()->CreateBasicBlock()); |
2021 | 2022 |
2022 BuildKeyedIndexCheck(key, &index_name_split_continuation); | 2023 BuildKeyedIndexCheck(key, &index_name_split_continuation); |
2023 | 2024 |
2024 IfBuilder index_name_split(this, &index_name_split_continuation); | 2025 IfBuilder index_name_split(this, &index_name_split_continuation); |
2025 index_name_split.Then(); | 2026 index_name_split.Then(); |
2026 { | 2027 { |
2027 // Key is an index (number) | 2028 // Key is an index (number) |
(...skipping 23 matching lines...) Expand all Loading... |
2051 } | 2052 } |
2052 kind_if.Else(); | 2053 kind_if.Else(); |
2053 | 2054 |
2054 // The DICTIONARY_ELEMENTS check generates a "kind_if.Then" | 2055 // The DICTIONARY_ELEMENTS check generates a "kind_if.Then" |
2055 BuildElementsKindLimitCheck(&kind_if, bit_field2, DICTIONARY_ELEMENTS); | 2056 BuildElementsKindLimitCheck(&kind_if, bit_field2, DICTIONARY_ELEMENTS); |
2056 { | 2057 { |
2057 HValue* elements = AddLoadElements(receiver); | 2058 HValue* elements = AddLoadElements(receiver); |
2058 | 2059 |
2059 HValue* hash = BuildElementIndexHash(key); | 2060 HValue* hash = BuildElementIndexHash(key); |
2060 | 2061 |
2061 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash, | 2062 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash)); |
2062 casted_stub()->language_mode())); | |
2063 } | 2063 } |
2064 kind_if.Else(); | 2064 kind_if.Else(); |
2065 | 2065 |
2066 // The SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" | 2066 // The SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" |
2067 BuildElementsKindLimitCheck(&kind_if, bit_field2, | 2067 BuildElementsKindLimitCheck(&kind_if, bit_field2, |
2068 SLOPPY_ARGUMENTS_ELEMENTS); | 2068 SLOPPY_ARGUMENTS_ELEMENTS); |
2069 // Non-strict elements are not handled. | 2069 // Non-strict elements are not handled. |
2070 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, | 2070 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, |
2071 Deoptimizer::EAGER); | 2071 Deoptimizer::EAGER); |
2072 Push(graph()->GetConstant0()); | 2072 Push(graph()->GetConstant0()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2130 BuildNonGlobalObjectCheck(receiver); | 2130 BuildNonGlobalObjectCheck(receiver); |
2131 | 2131 |
2132 HValue* properties = Add<HLoadNamedField>( | 2132 HValue* properties = Add<HLoadNamedField>( |
2133 receiver, nullptr, HObjectAccess::ForPropertiesPointer()); | 2133 receiver, nullptr, HObjectAccess::ForPropertiesPointer()); |
2134 | 2134 |
2135 HValue* hash = | 2135 HValue* hash = |
2136 Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForNameHashField()); | 2136 Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForNameHashField()); |
2137 | 2137 |
2138 hash = AddUncasted<HShr>(hash, Add<HConstant>(Name::kHashShift)); | 2138 hash = AddUncasted<HShr>(hash, Add<HConstant>(Name::kHashShift)); |
2139 | 2139 |
2140 HValue* value = BuildUncheckedDictionaryElementLoad( | 2140 HValue* value = BuildUncheckedDictionaryElementLoad(receiver, |
2141 receiver, properties, key, hash, casted_stub()->language_mode()); | 2141 properties, |
| 2142 key, |
| 2143 hash); |
2142 Push(value); | 2144 Push(value); |
2143 } | 2145 } |
2144 if_dict_properties.Else(); | 2146 if_dict_properties.Else(); |
2145 { | 2147 { |
2146 // TODO(dcarney): don't use keyed lookup cache, but convert to use | 2148 // TODO(dcarney): don't use keyed lookup cache, but convert to use |
2147 // megamorphic stub cache. | 2149 // megamorphic stub cache. |
2148 UNREACHABLE(); | 2150 UNREACHABLE(); |
2149 // Key is string, properties are fast mode | 2151 // Key is string, properties are fast mode |
2150 HValue* hash = BuildKeyedLookupCacheHash(receiver, key); | 2152 HValue* hash = BuildKeyedLookupCacheHash(receiver, key); |
2151 | 2153 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 | 2208 |
2207 IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation); | 2209 IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation); |
2208 inline_or_runtime.Then(); | 2210 inline_or_runtime.Then(); |
2209 { | 2211 { |
2210 // Found a cached index, load property inline. | 2212 // Found a cached index, load property inline. |
2211 Push(Add<HLoadFieldByIndex>(receiver, Pop())); | 2213 Push(Add<HLoadFieldByIndex>(receiver, Pop())); |
2212 } | 2214 } |
2213 inline_or_runtime.Else(); | 2215 inline_or_runtime.Else(); |
2214 { | 2216 { |
2215 // KeyedLookupCache miss; call runtime. | 2217 // KeyedLookupCache miss; call runtime. |
2216 Add<HPushArguments>(receiver, key, | 2218 Add<HPushArguments>(receiver, key); |
2217 Add<HConstant>(casted_stub()->language_mode())); | |
2218 Push(Add<HCallRuntime>( | 2219 Push(Add<HCallRuntime>( |
2219 isolate()->factory()->empty_string(), | 2220 isolate()->factory()->empty_string(), |
2220 Runtime::FunctionForId(Runtime::kKeyedGetProperty), 3)); | 2221 Runtime::FunctionForId(Runtime::kKeyedGetProperty), 2)); |
2221 } | 2222 } |
2222 inline_or_runtime.End(); | 2223 inline_or_runtime.End(); |
2223 } | 2224 } |
2224 if_dict_properties.End(); | 2225 if_dict_properties.End(); |
2225 } | 2226 } |
2226 index_name_split.End(); | 2227 index_name_split.End(); |
2227 | 2228 |
2228 return Pop(); | 2229 return Pop(); |
2229 } | 2230 } |
2230 | 2231 |
2231 | 2232 |
2232 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2233 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2233 return DoGenerateCode(this); | 2234 return DoGenerateCode(this); |
2234 } | 2235 } |
2235 | 2236 |
2236 } // namespace internal | 2237 } // namespace internal |
2237 } // namespace v8 | 2238 } // namespace v8 |
OLD | NEW |