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/code-stubs-hydrogen.cc

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase 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/code-stubs.cc ('k') | src/compiler/ast-graph-builder.cc » ('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 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
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 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() { 1893 HValue* CodeStubGraphBuilder<LoadDictionaryElementStub>::BuildCodeStub() {
1895 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex); 1894 HValue* receiver = GetParameter(LoadDescriptor::kReceiverIndex);
1896 HValue* key = GetParameter(LoadDescriptor::kNameIndex); 1895 HValue* key = GetParameter(LoadDescriptor::kNameIndex);
1897 1896
1898 Add<HCheckSmi>(key); 1897 Add<HCheckSmi>(key);
1899 1898
1900 HValue* elements = AddLoadElements(receiver); 1899 HValue* elements = AddLoadElements(receiver);
1901 1900
1902 HValue* hash = BuildElementIndexHash(key); 1901 HValue* hash = BuildElementIndexHash(key);
1903 1902
1904 return BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash); 1903 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
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
2019 // Split into a smi/integer case and unique string case. 2018 // Split into a smi/integer case and unique string case.
2020 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(), 2019 HIfContinuation index_name_split_continuation(graph()->CreateBasicBlock(),
2021 graph()->CreateBasicBlock()); 2020 graph()->CreateBasicBlock());
2022 2021
2023 BuildKeyedIndexCheck(key, &index_name_split_continuation); 2022 BuildKeyedIndexCheck(key, &index_name_split_continuation);
2024 2023
2025 IfBuilder index_name_split(this, &index_name_split_continuation); 2024 IfBuilder index_name_split(this, &index_name_split_continuation);
2026 index_name_split.Then(); 2025 index_name_split.Then();
2027 { 2026 {
2028 // Key is an index (number) 2027 // Key is an index (number)
(...skipping 23 matching lines...) Expand all
2052 } 2051 }
2053 kind_if.Else(); 2052 kind_if.Else();
2054 2053
2055 // The DICTIONARY_ELEMENTS check generates a "kind_if.Then" 2054 // The DICTIONARY_ELEMENTS check generates a "kind_if.Then"
2056 BuildElementsKindLimitCheck(&kind_if, bit_field2, DICTIONARY_ELEMENTS); 2055 BuildElementsKindLimitCheck(&kind_if, bit_field2, DICTIONARY_ELEMENTS);
2057 { 2056 {
2058 HValue* elements = AddLoadElements(receiver); 2057 HValue* elements = AddLoadElements(receiver);
2059 2058
2060 HValue* hash = BuildElementIndexHash(key); 2059 HValue* hash = BuildElementIndexHash(key);
2061 2060
2062 Push(BuildUncheckedDictionaryElementLoad(receiver, elements, key, hash)); 2061 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
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(receiver, 2140 HValue* value = BuildUncheckedDictionaryElementLoad(
2141 properties, 2141 receiver, properties, key, hash, casted_stub()->language_mode());
2142 key,
2143 hash);
2144 Push(value); 2142 Push(value);
2145 } 2143 }
2146 if_dict_properties.Else(); 2144 if_dict_properties.Else();
2147 { 2145 {
2148 // TODO(dcarney): don't use keyed lookup cache, but convert to use 2146 // TODO(dcarney): don't use keyed lookup cache, but convert to use
2149 // megamorphic stub cache. 2147 // megamorphic stub cache.
2150 UNREACHABLE(); 2148 UNREACHABLE();
2151 // Key is string, properties are fast mode 2149 // Key is string, properties are fast mode
2152 HValue* hash = BuildKeyedLookupCacheHash(receiver, key); 2150 HValue* hash = BuildKeyedLookupCacheHash(receiver, key);
2153 2151
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 2206
2209 IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation); 2207 IfBuilder inline_or_runtime(this, &inline_or_runtime_continuation);
2210 inline_or_runtime.Then(); 2208 inline_or_runtime.Then();
2211 { 2209 {
2212 // Found a cached index, load property inline. 2210 // Found a cached index, load property inline.
2213 Push(Add<HLoadFieldByIndex>(receiver, Pop())); 2211 Push(Add<HLoadFieldByIndex>(receiver, Pop()));
2214 } 2212 }
2215 inline_or_runtime.Else(); 2213 inline_or_runtime.Else();
2216 { 2214 {
2217 // KeyedLookupCache miss; call runtime. 2215 // KeyedLookupCache miss; call runtime.
2218 Add<HPushArguments>(receiver, key); 2216 Add<HPushArguments>(receiver, key,
2217 Add<HConstant>(casted_stub()->language_mode()));
2219 Push(Add<HCallRuntime>( 2218 Push(Add<HCallRuntime>(
2220 isolate()->factory()->empty_string(), 2219 isolate()->factory()->empty_string(),
2221 Runtime::FunctionForId(Runtime::kKeyedGetProperty), 2)); 2220 Runtime::FunctionForId(Runtime::kKeyedGetProperty), 3));
2222 } 2221 }
2223 inline_or_runtime.End(); 2222 inline_or_runtime.End();
2224 } 2223 }
2225 if_dict_properties.End(); 2224 if_dict_properties.End();
2226 } 2225 }
2227 index_name_split.End(); 2226 index_name_split.End();
2228 2227
2229 return Pop(); 2228 return Pop();
2230 } 2229 }
2231 2230
2232 2231
2233 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2232 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2234 return DoGenerateCode(this); 2233 return DoGenerateCode(this);
2235 } 2234 }
2236 2235
2237 } // namespace internal 2236 } // namespace internal
2238 } // namespace v8 2237 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698