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

Side by Side Diff: src/hydrogen.cc

Issue 220163012: Inline loading of immutable properties (Closed) Base URL: https://github.com/v8/v8.git@master
Patch Set: 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 6698 matching lines...) Expand 10 before | Expand all | Expand 10 after
6709 6709
6710 } else if (expr->IsFunctionPrototype()) { 6710 } else if (expr->IsFunctionPrototype()) {
6711 HValue* function = Pop(); 6711 HValue* function = Pop();
6712 BuildCheckHeapObject(function); 6712 BuildCheckHeapObject(function);
6713 instr = New<HLoadFunctionPrototype>(function); 6713 instr = New<HLoadFunctionPrototype>(function);
6714 6714
6715 } else if (expr->key()->IsPropertyName()) { 6715 } else if (expr->key()->IsPropertyName()) {
6716 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName(); 6716 Handle<String> name = expr->key()->AsLiteral()->AsPropertyName();
6717 HValue* object = Pop(); 6717 HValue* object = Pop();
6718 6718
6719 // See if the property to be loaded is non-configurable and non-writable
6720 if (object->IsConstant() &&
6721 HConstant::cast(object)->handle(isolate())->IsJSObject()) {
6722 Handle<JSObject> js_object =
6723 Handle<JSObject>::cast(HConstant::cast(object)->handle(isolate()));
6724
6725 if (!js_object->map()->is_observed()) {
6726 LookupResult lookup(isolate());
6727 js_object->LocalLookup(*name, &lookup, false);
6728
6729 if (lookup.IsFound() && lookup.IsCacheable() &&
6730 (js_object->map()->is_frozen() ||
Toon Verwaest 2014/04/02 14:51:47 You don't need to special-case is_frozen(), such p
6731 (lookup.IsReadOnly() && lookup.IsDontDelete()))) {
6732 Handle<Object> value = handle(lookup.GetLazyValue(), isolate());
6733
6734 if (!value.is_null() &&
6735 !value->IsTheHole() &&
6736 !value->IsCallable()) {
Toon Verwaest 2014/04/02 14:51:47 Why these cases? Can you introduce abstractions th
p.antonov 2014/04/02 15:53:58 The null check should actually be unnecessary (sin
6737 instr = New<HConstant>(value);
6738 return ast_context()->ReturnInstruction(instr, ast_id);
6739 }
6740 }
6741 }
6742 }
6743
6719 instr = BuildNamedAccess(LOAD, ast_id, expr->LoadId(), expr, 6744 instr = BuildNamedAccess(LOAD, ast_id, expr->LoadId(), expr,
6720 object, name, NULL, expr->IsUninitialized()); 6745 object, name, NULL, expr->IsUninitialized());
6721 if (instr == NULL) return; 6746 if (instr == NULL) return;
6722 if (instr->IsLinked()) return ast_context()->ReturnValue(instr); 6747 if (instr->IsLinked()) return ast_context()->ReturnValue(instr);
6723 6748
6724 } else { 6749 } else {
6725 HValue* key = Pop(); 6750 HValue* key = Pop();
6726 HValue* obj = Pop(); 6751 HValue* obj = Pop();
6727 6752
6728 bool has_side_effects = false; 6753 bool has_side_effects = false;
(...skipping 4772 matching lines...) Expand 10 before | Expand all | Expand 10 after
11501 if (ShouldProduceTraceOutput()) { 11526 if (ShouldProduceTraceOutput()) {
11502 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11527 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11503 } 11528 }
11504 11529
11505 #ifdef DEBUG 11530 #ifdef DEBUG
11506 graph_->Verify(false); // No full verify. 11531 graph_->Verify(false); // No full verify.
11507 #endif 11532 #endif
11508 } 11533 }
11509 11534
11510 } } // namespace v8::internal 11535 } } // 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