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

Side by Side Diff: src/hydrogen.cc

Issue 232853002: Inline immutable property loads (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: Address comment Created 6 years, 8 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 | « no previous file | no next file » | no next file with comments »
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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5323 matching lines...) Expand 10 before | Expand all | Expand 10 after
5334 HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object, 5334 HCheckMaps* HOptimizedGraphBuilder::AddCheckMap(HValue* object,
5335 Handle<Map> map) { 5335 Handle<Map> map) {
5336 BuildCheckHeapObject(object); 5336 BuildCheckHeapObject(object);
5337 return Add<HCheckMaps>(object, map, top_info()); 5337 return Add<HCheckMaps>(object, map, top_info());
5338 } 5338 }
5339 5339
5340 5340
5341 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField( 5341 HInstruction* HOptimizedGraphBuilder::BuildLoadNamedField(
5342 PropertyAccessInfo* info, 5342 PropertyAccessInfo* info,
5343 HValue* checked_object) { 5343 HValue* checked_object) {
5344 // See if this is a load for an immutable property
5345 if (checked_object->ActualValue()->IsConstant() &&
5346 info->lookup()->IsCacheable() &&
5347 info->lookup()->IsReadOnly() && info->lookup()->IsDontDelete()) {
5348 Handle<Object> object(
5349 HConstant::cast(checked_object->ActualValue())->handle(isolate()));
5350
5351 if (object->IsJSObject()) {
5352 LookupResult lookup(isolate());
5353 Handle<JSObject>::cast(object)->Lookup(*info->name(), &lookup);
5354 Handle<Object> value(lookup.GetLazyValue(), isolate());
5355
5356 if (!value->IsTheHole()) {
5357 return New<HConstant>(value);
5358 }
5359 }
5360 }
5361
5344 HObjectAccess access = info->access(); 5362 HObjectAccess access = info->access();
5345 if (access.representation().IsDouble()) { 5363 if (access.representation().IsDouble()) {
5346 // Load the heap number. 5364 // Load the heap number.
5347 checked_object = Add<HLoadNamedField>( 5365 checked_object = Add<HLoadNamedField>(
5348 checked_object, static_cast<HValue*>(NULL), 5366 checked_object, static_cast<HValue*>(NULL),
5349 access.WithRepresentation(Representation::Tagged())); 5367 access.WithRepresentation(Representation::Tagged()));
5350 checked_object->set_type(HType::HeapNumber()); 5368 checked_object->set_type(HType::HeapNumber());
5351 // Load the double value from it. 5369 // Load the double value from it.
5352 access = HObjectAccess::ForHeapNumberValue(); 5370 access = HObjectAccess::ForHeapNumberValue();
5353 } 5371 }
(...skipping 6170 matching lines...) Expand 10 before | Expand all | Expand 10 after
11524 if (ShouldProduceTraceOutput()) { 11542 if (ShouldProduceTraceOutput()) {
11525 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11543 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11526 } 11544 }
11527 11545
11528 #ifdef DEBUG 11546 #ifdef DEBUG
11529 graph_->Verify(false); // No full verify. 11547 graph_->Verify(false); // No full verify.
11530 #endif 11548 #endif
11531 } 11549 }
11532 11550
11533 } } // namespace v8::internal 11551 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698