Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: src/crankshaft/hydrogen.cc

Issue 2405213002: V8 support for cached accessors. (Closed)
Patch Set: Centralized lookup in LookupIterator::TryLookupCacheProperty. Also rebase. Created 4 years, 2 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/api.cc ('k') | src/ic/ic.cc » ('j') | src/ic/ic.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/crankshaft/hydrogen.h" 5 #include "src/crankshaft/hydrogen.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/allocation-site-scopes.h" 10 #include "src/allocation-site-scopes.h"
(...skipping 5387 matching lines...) Expand 10 before | Expand all | Expand 10 after
5398 return Bailout(kReferenceToUninitializedVariable); 5398 return Bailout(kReferenceToUninitializedVariable);
5399 } 5399 }
5400 HInstruction* result = New<HLoadNamedField>( 5400 HInstruction* result = New<HLoadNamedField>(
5401 Add<HConstant>(script_context), nullptr, 5401 Add<HConstant>(script_context), nullptr,
5402 HObjectAccess::ForContextSlot(lookup.slot_index)); 5402 HObjectAccess::ForContextSlot(lookup.slot_index));
5403 return ast_context()->ReturnInstruction(result, expr->id()); 5403 return ast_context()->ReturnInstruction(result, expr->id());
5404 } 5404 }
5405 } 5405 }
5406 5406
5407 LookupIterator it(global, variable->name(), LookupIterator::OWN); 5407 LookupIterator it(global, variable->name(), LookupIterator::OWN);
5408 it.TryLookupCacheProperty();
5408 if (CanInlineGlobalPropertyAccess(variable, &it, LOAD)) { 5409 if (CanInlineGlobalPropertyAccess(variable, &it, LOAD)) {
5409 InlineGlobalPropertyLoad(&it, expr->id()); 5410 InlineGlobalPropertyLoad(&it, expr->id());
5410 return; 5411 return;
5411 } else { 5412 } else {
5412 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate()); 5413 Handle<TypeFeedbackVector> vector(current_feedback_vector(), isolate());
5413 5414
5414 HValue* vector_value = Add<HConstant>(vector); 5415 HValue* vector_value = Add<HConstant>(vector);
5415 HValue* slot_value = 5416 HValue* slot_value =
5416 Add<HConstant>(vector->GetIndex(expr->VariableFeedbackSlot())); 5417 Add<HConstant>(vector->GetIndex(expr->VariableFeedbackSlot()));
5417 Callable callable = CodeFactory::LoadGlobalICInOptimizedCode( 5418 Callable callable = CodeFactory::LoadGlobalICInOptimizedCode(
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
6209 return BuildStoreNamedField(info, checked_object, value); 6210 return BuildStoreNamedField(info, checked_object, value);
6210 } 6211 }
6211 } 6212 }
6212 6213
6213 if (info->IsTransition()) { 6214 if (info->IsTransition()) {
6214 DCHECK(!info->IsLoad()); 6215 DCHECK(!info->IsLoad());
6215 return BuildStoreNamedField(info, checked_object, value); 6216 return BuildStoreNamedField(info, checked_object, value);
6216 } 6217 }
6217 6218
6218 if (info->IsAccessorConstant()) { 6219 if (info->IsAccessorConstant()) {
6220 MaybeHandle<Name> maybe_name =
6221 FunctionTemplateInfo::TryGetCachePropertyName(isolate(),
6222 info->accessor());
6223 if (!maybe_name.is_null()) {
6224 Handle<Name> name = maybe_name.ToHandleChecked();
6225 PropertyAccessInfo cache_info(this, LOAD, info->map(), name);
6226 // Load new target.
6227 if (cache_info.CanAccessMonomorphic())
6228 return BuildLoadNamedField(&cache_info, checked_object);
6229 }
6230
6219 Push(checked_object); 6231 Push(checked_object);
6220 int argument_count = 1; 6232 int argument_count = 1;
6221 if (!info->IsLoad()) { 6233 if (!info->IsLoad()) {
6222 argument_count = 2; 6234 argument_count = 2;
6223 Push(value); 6235 Push(value);
6224 } 6236 }
6225 6237
6226 if (info->accessor()->IsJSFunction() && 6238 if (info->accessor()->IsJSFunction() &&
6227 info->NeedsWrappingFor(Handle<JSFunction>::cast(info->accessor()))) { 6239 info->NeedsWrappingFor(Handle<JSFunction>::cast(info->accessor()))) {
6228 HValue* function = Add<HConstant>(info->accessor()); 6240 HValue* function = Add<HConstant>(info->accessor());
(...skipping 6915 matching lines...) Expand 10 before | Expand all | Expand 10 after
13144 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13156 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13145 } 13157 }
13146 13158
13147 #ifdef DEBUG 13159 #ifdef DEBUG
13148 graph_->Verify(false); // No full verify. 13160 graph_->Verify(false); // No full verify.
13149 #endif 13161 #endif
13150 } 13162 }
13151 13163
13152 } // namespace internal 13164 } // namespace internal
13153 } // namespace v8 13165 } // namespace v8
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/ic/ic.cc » ('j') | src/ic/ic.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698