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

Issue 1742253002: [crankshaft] Inline hasOwnProperty when used in fast-case for-in (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix: disable if OSR. Otherwise elements of for-in can have more elements in the phi (the OSR entry … Created 4 years, 9 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 | src/objects.h » ('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 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 <sstream> 7 #include <sstream>
8 8
9 #include "src/allocation-site-scopes.h" 9 #include "src/allocation-site-scopes.h"
10 #include "src/ast/ast-numbering.h" 10 #include "src/ast/ast-numbering.h"
(...skipping 8734 matching lines...) Expand 10 before | Expand all | Expand 10 after
8745 HValue* receiver = environment()->ExpressionStackAt(args_count_no_receiver); 8745 HValue* receiver = environment()->ExpressionStackAt(args_count_no_receiver);
8746 if (receiver->IsConstant() && 8746 if (receiver->IsConstant() &&
8747 HConstant::cast(receiver)->handle(isolate())->IsHeapObject()) { 8747 HConstant::cast(receiver)->handle(isolate())->IsHeapObject()) {
8748 receiver_map = 8748 receiver_map =
8749 handle(Handle<HeapObject>::cast( 8749 handle(Handle<HeapObject>::cast(
8750 HConstant::cast(receiver)->handle(isolate()))->map()); 8750 HConstant::cast(receiver)->handle(isolate()))->map());
8751 } 8751 }
8752 } 8752 }
8753 // Try to inline calls like Math.* as operations in the calling function. 8753 // Try to inline calls like Math.* as operations in the calling function.
8754 switch (id) { 8754 switch (id) {
8755 case kObjectHasOwnProperty: {
8756 // It's not safe to look through the phi for elements if we're compiling
8757 // for osr.
8758 if (top_info()->is_osr()) return false;
8759 if (argument_count != 2) return false;
8760 HValue* key = Top();
8761 if (!key->IsLoadKeyed()) return false;
8762 HValue* elements = HLoadKeyed::cast(key)->elements();
8763 if (!elements->IsPhi() || elements->OperandCount() != 1) return false;
8764 if (!elements->OperandAt(0)->IsForInCacheArray()) return false;
8765 HForInCacheArray* cache = HForInCacheArray::cast(elements->OperandAt(0));
8766 HValue* receiver = environment()->ExpressionStackAt(1);
8767 if (!receiver->IsPhi() || receiver->OperandCount() != 1) return false;
8768 if (cache->enumerable() != receiver->OperandAt(0)) return false;
8769 Drop(3); // key, receiver, function
8770 Add<HCheckMapValue>(receiver, cache->map());
8771 ast_context()->ReturnValue(graph()->GetConstantTrue());
8772 return true;
8773 }
8755 case kStringCharCodeAt: 8774 case kStringCharCodeAt:
8756 case kStringCharAt: 8775 case kStringCharAt:
8757 if (argument_count == 2) { 8776 if (argument_count == 2) {
8758 HValue* index = Pop(); 8777 HValue* index = Pop();
8759 HValue* string = Pop(); 8778 HValue* string = Pop();
8760 Drop(1); // Function. 8779 Drop(1); // Function.
8761 HInstruction* char_code = 8780 HInstruction* char_code =
8762 BuildStringCharCodeAt(string, index); 8781 BuildStringCharCodeAt(string, index);
8763 if (id == kStringCharCodeAt) { 8782 if (id == kStringCharCodeAt) {
8764 ast_context()->ReturnInstruction(char_code, expr->id()); 8783 ast_context()->ReturnInstruction(char_code, expr->id());
(...skipping 4688 matching lines...) Expand 10 before | Expand all | Expand 10 after
13453 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13472 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13454 } 13473 }
13455 13474
13456 #ifdef DEBUG 13475 #ifdef DEBUG
13457 graph_->Verify(false); // No full verify. 13476 graph_->Verify(false); // No full verify.
13458 #endif 13477 #endif
13459 } 13478 }
13460 13479
13461 } // namespace internal 13480 } // namespace internal
13462 } // namespace v8 13481 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698