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, | 65 HLoadNamedField* BuildLoadNamedField(HValue* object, FieldIndex index); |
66 FieldIndex index); | |
67 void BuildStoreNamedField(HValue* object, HValue* value, FieldIndex index, | 66 void BuildStoreNamedField(HValue* object, HValue* value, FieldIndex index, |
68 Representation representation, | 67 Representation representation, |
69 bool transition_to_field); | 68 bool transition_to_field); |
70 | 69 |
71 enum ArgumentClass { | 70 enum ArgumentClass { |
72 NONE, | 71 NONE, |
73 SINGLE, | 72 SINGLE, |
74 MULTIPLE | 73 MULTIPLE |
75 }; | 74 }; |
76 | 75 |
(...skipping 1841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1918 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { | 1917 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { |
1919 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); | 1918 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); |
1920 HValue* key = GetParameter(LoadDescriptor::kNameIndex); | 1919 HValue* key = GetParameter(LoadDescriptor::kNameIndex); |
1921 | 1920 |
1922 Add<HCheckSmi>(key); | 1921 Add<HCheckSmi>(key); |
1923 | 1922 |
1924 HValue* elements = AddLoadElements(receiver); | 1923 HValue* elements = AddLoadElements(receiver); |
1925 | 1924 |
1926 HValue* hash = BuildElementIndexHash(key); | 1925 HValue* hash = BuildElementIndexHash(key); |
1927 | 1926 |
1928 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash); | 1927 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash, |
| 1928 casted_stub()->language_mode()); |
1929 } | 1929 } |
1930 | 1930 |
1931 | 1931 |
1932 Handle<Code> LoadDictionaryElementStub::GenerateCode() { | 1932 Handle<Code> LoadDictionaryElementStub::GenerateCode() { |
1933 return DoGenerateCode(this); | 1933 return DoGenerateCode(this); |
1934 } | 1934 } |
1935 | 1935 |
1936 | 1936 |
1937 template<> | 1937 template<> |
1938 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { | 1938 HValue* CodeStubGraphBuilder<RegExpConstructResultStub>::BuildCodeStub() { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2032 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, | 2032 Push(BuildUncheckedMonomorphicElementAccess(receiver, key, NULL, |
2033 false, kind, | 2033 false, kind, |
2034 LOAD, NEVER_RETURN_HOLE, | 2034 LOAD, NEVER_RETURN_HOLE, |
2035 STANDARD_STORE)); | 2035 STANDARD_STORE)); |
2036 } | 2036 } |
2037 | 2037 |
2038 | 2038 |
2039 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { | 2039 HValue* CodeStubGraphBuilder<KeyedLoadGenericStub>::BuildCodeStub() { |
2040 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); | 2040 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); |
2041 HValue* key = GetParameter(LoadDescriptor::kNameIndex); | 2041 HValue* key = GetParameter(LoadDescriptor::kNameIndex); |
2042 | |
2043 // Split into a smi/integer case and unique string case. | 2042 // Split into a smi/integer case and unique string case. |
2044 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), | 2043 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), |
2045 graph()->CreateBasicBlock()); | 2044 graph()->CreateBasicBlock()); |
2046 | 2045 |
2047 BuildKeyedIndexCheck(key, &index_name_split_continuation); | 2046 BuildKeyedIndexCheck(key, &index_name_split_continuation); |
2048 | 2047 |
2049 IfBuilder index_name_split(this, &index_name_split_continuation); | 2048 IfBuilder index_name_split(this, &index_name_split_continuation); |
2050 index_name_split.Then(); | 2049 index_name_split.Then(); |
2051 { | 2050 { |
2052 // Key is an index (number) | 2051 // Key is an index (number) |
(...skipping 23 matching lines...) Expand all Loading... |
2076 } | 2075 } |
2077 kind_if.Else(); | 2076 kind_if.Else(); |
2078 | 2077 |
2079 // The DICTIONARY_ELEMENTS check generates a "kind_if.Then" | 2078 // The DICTIONARY_ELEMENTS check generates a "kind_if.Then" |
2080 BuildElementsKindLimitCheck(&kind_if, bit_field2, DICTIONARY_ELEMENTS); | 2079 BuildElementsKindLimitCheck(&kind_if, bit_field2, DICTIONARY_ELEMENTS); |
2081 { | 2080 { |
2082 HValue* elements = AddLoadElements(receiver); | 2081 HValue* elements = AddLoadElements(receiver); |
2083 | 2082 |
2084 HValue* hash = BuildElementIndexHash(key); | 2083 HValue* hash = BuildElementIndexHash(key); |
2085 | 2084 |
2086 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash)); | 2085 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash, |
| 2086 casted_stub()->language_mode())); |
2087 } | 2087 } |
2088 kind_if.Else(); | 2088 kind_if.Else(); |
2089 | 2089 |
2090 // The SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" | 2090 // The SLOPPY_ARGUMENTS_ELEMENTS check generates a "kind_if.Then" |
2091 BuildElementsKindLimitCheck(&kind_if, bit_field2, | 2091 BuildElementsKindLimitCheck(&kind_if, bit_field2, |
2092 SLOPPY_ARGUMENTS_ELEMENTS); | 2092 SLOPPY_ARGUMENTS_ELEMENTS); |
2093 // Non-strict elements are not handled. | 2093 // Non-strict elements are not handled. |
2094 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, | 2094 Add<HDeoptimize>(Deoptimizer::kNonStrictElementsInKeyedLoadGenericStub, |
2095 Deoptimizer::EAGER); | 2095 Deoptimizer::EAGER); |
2096 Push(graph()->GetConstant0()); | 2096 Push(graph()->GetConstant0()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 BuildNonGlobalObjectCheck(receiver); | 2154 BuildNonGlobalObjectCheck(receiver); |
2155 | 2155 |
2156 HValue* properties = Add<HLoadNamedField>( | 2156 HValue* properties = Add<HLoadNamedField>( |
2157 receiver, nullptr, HObjectAccess::ForPropertiesPointer()); | 2157 receiver, nullptr, HObjectAccess::ForPropertiesPointer()); |
2158 | 2158 |
2159 HValue* hash = | 2159 HValue* hash = |
2160 Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForNameHashField()); | 2160 Add<HLoadNamedField>(key, nullptr, HObjectAccess::ForNameHashField()); |
2161 | 2161 |
2162 hash = AddUncasted<HShr>(hash, Add<HConstant>(Name::kHashShift)); | 2162 hash = AddUncasted<HShr>(hash, Add<HConstant>(Name::kHashShift)); |
2163 | 2163 |
2164 HValue* value = BuildUncheckedDictionaryElementLoad(receiver, | 2164 HValue* value = BuildUncheckedDictionaryElementLoad( |
2165 properties, | 2165 receiver, properties, key, hash, casted_stub()->language_mode()); |
2166 key, | |
2167 hash); | |
2168 Push(value); | 2166 Push(value); |
2169 } | 2167 } |
2170 if_dict_properties.Else(); | 2168 if_dict_properties.Else(); |
2171 { | 2169 { |
2172 // TODO(dcarney): don't use keyed lookup cache, but convert to use | 2170 // TODO(dcarney): don't use keyed lookup cache, but convert to use |
2173 // megamorphic stub cache. | 2171 // megamorphic stub cache. |
2174 UNREACHABLE(); | 2172 UNREACHABLE(); |
2175 // Key is string, properties are fast mode | 2173 // Key is string, properties are fast mode |
2176 HValue* hash = BuildKeyedLookupCacheHash(receiver, key); | 2174 HValue* hash = BuildKeyedLookupCacheHash(receiver, key); |
2177 | 2175 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2235 { | 2233 { |
2236 // Found a cached index, load property inline. | 2234 // Found a cached index, load property inline. |
2237 Push(Add<HLoadFieldByIndex>(receiver, Pop())); | 2235 Push(Add<HLoadFieldByIndex>(receiver, Pop())); |
2238 } | 2236 } |
2239 inline_or_runtime.Else(); | 2237 inline_or_runtime.Else(); |
2240 { | 2238 { |
2241 // KeyedLookupCache miss; call runtime. | 2239 // KeyedLookupCache miss; call runtime. |
2242 Add<HPushArguments>(receiver, key); | 2240 Add<HPushArguments>(receiver, key); |
2243 Push(Add<HCallRuntime>( | 2241 Push(Add<HCallRuntime>( |
2244 isolate()->factory()->empty_string(), | 2242 isolate()->factory()->empty_string(), |
2245 Runtime::FunctionForId(Runtime::kKeyedGetProperty), 2)); | 2243 Runtime::FunctionForId(is_strong(casted_stub()->language_mode()) |
| 2244 ? Runtime::kKeyedGetPropertyStrong |
| 2245 : Runtime::kKeyedGetProperty), |
| 2246 2)); |
2246 } | 2247 } |
2247 inline_or_runtime.End(); | 2248 inline_or_runtime.End(); |
2248 } | 2249 } |
2249 if_dict_properties.End(); | 2250 if_dict_properties.End(); |
2250 } | 2251 } |
2251 index_name_split.End(); | 2252 index_name_split.End(); |
2252 | 2253 |
2253 return Pop(); | 2254 return Pop(); |
2254 } | 2255 } |
2255 | 2256 |
2256 | 2257 |
2257 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2258 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2258 return DoGenerateCode(this); | 2259 return DoGenerateCode(this); |
2259 } | 2260 } |
2260 | 2261 |
2261 } // namespace internal | 2262 } // namespace internal |
2262 } // namespace v8 | 2263 } // namespace v8 |
OLD | NEW |