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

Side by Side Diff: src/hydrogen.cc

Issue 26859003: Add instruction factories to HHasInstanceTypeAndBranch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/hydrogen-instructions.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 // 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 3457 matching lines...) Expand 10 before | Expand all | Expand 10 after
3468 current_block()->Goto(test->if_true(), state); 3468 current_block()->Goto(test->if_true(), state);
3469 } else if (context->IsEffect()) { 3469 } else if (context->IsEffect()) {
3470 CHECK_ALIVE(VisitForEffect(stmt->expression())); 3470 CHECK_ALIVE(VisitForEffect(stmt->expression()));
3471 current_block()->Goto(function_return(), state); 3471 current_block()->Goto(function_return(), state);
3472 } else { 3472 } else {
3473 ASSERT(context->IsValue()); 3473 ASSERT(context->IsValue());
3474 CHECK_ALIVE(VisitForValue(stmt->expression())); 3474 CHECK_ALIVE(VisitForValue(stmt->expression()));
3475 HValue* return_value = Pop(); 3475 HValue* return_value = Pop();
3476 HValue* receiver = environment()->arguments_environment()->Lookup(0); 3476 HValue* receiver = environment()->arguments_environment()->Lookup(0);
3477 HHasInstanceTypeAndBranch* typecheck = 3477 HHasInstanceTypeAndBranch* typecheck =
3478 new(zone()) HHasInstanceTypeAndBranch(return_value, 3478 New<HHasInstanceTypeAndBranch>(return_value,
3479 FIRST_SPEC_OBJECT_TYPE, 3479 FIRST_SPEC_OBJECT_TYPE,
3480 LAST_SPEC_OBJECT_TYPE); 3480 LAST_SPEC_OBJECT_TYPE);
3481 HBasicBlock* if_spec_object = graph()->CreateBasicBlock(); 3481 HBasicBlock* if_spec_object = graph()->CreateBasicBlock();
3482 HBasicBlock* not_spec_object = graph()->CreateBasicBlock(); 3482 HBasicBlock* not_spec_object = graph()->CreateBasicBlock();
3483 typecheck->SetSuccessorAt(0, if_spec_object); 3483 typecheck->SetSuccessorAt(0, if_spec_object);
3484 typecheck->SetSuccessorAt(1, not_spec_object); 3484 typecheck->SetSuccessorAt(1, not_spec_object);
3485 current_block()->Finish(typecheck); 3485 current_block()->Finish(typecheck);
3486 if_spec_object->AddLeaveInlined(return_value, state); 3486 if_spec_object->AddLeaveInlined(return_value, state);
3487 not_spec_object->AddLeaveInlined(receiver, state); 3487 not_spec_object->AddLeaveInlined(receiver, state);
3488 } 3488 }
3489 } else if (state->inlining_kind() == SETTER_CALL_RETURN) { 3489 } else if (state->inlining_kind() == SETTER_CALL_RETURN) {
3490 // Return from an inlined setter call. The returned value is never used, the 3490 // Return from an inlined setter call. The returned value is never used, the
(...skipping 5285 matching lines...) Expand 10 before | Expand all | Expand 10 after
8776 HIsSmiAndBranch* result = New<HIsSmiAndBranch>(value); 8776 HIsSmiAndBranch* result = New<HIsSmiAndBranch>(value);
8777 return ast_context()->ReturnControl(result, call->id()); 8777 return ast_context()->ReturnControl(result, call->id());
8778 } 8778 }
8779 8779
8780 8780
8781 void HOptimizedGraphBuilder::GenerateIsSpecObject(CallRuntime* call) { 8781 void HOptimizedGraphBuilder::GenerateIsSpecObject(CallRuntime* call) {
8782 ASSERT(call->arguments()->length() == 1); 8782 ASSERT(call->arguments()->length() == 1);
8783 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 8783 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
8784 HValue* value = Pop(); 8784 HValue* value = Pop();
8785 HHasInstanceTypeAndBranch* result = 8785 HHasInstanceTypeAndBranch* result =
8786 new(zone()) HHasInstanceTypeAndBranch(value, 8786 New<HHasInstanceTypeAndBranch>(value,
8787 FIRST_SPEC_OBJECT_TYPE, 8787 FIRST_SPEC_OBJECT_TYPE,
8788 LAST_SPEC_OBJECT_TYPE); 8788 LAST_SPEC_OBJECT_TYPE);
8789 return ast_context()->ReturnControl(result, call->id()); 8789 return ast_context()->ReturnControl(result, call->id());
8790 } 8790 }
8791 8791
8792 8792
8793 void HOptimizedGraphBuilder::GenerateIsFunction(CallRuntime* call) { 8793 void HOptimizedGraphBuilder::GenerateIsFunction(CallRuntime* call) {
8794 ASSERT(call->arguments()->length() == 1); 8794 ASSERT(call->arguments()->length() == 1);
8795 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 8795 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
8796 HValue* value = Pop(); 8796 HValue* value = Pop();
8797 HHasInstanceTypeAndBranch* result = 8797 HHasInstanceTypeAndBranch* result =
8798 new(zone()) HHasInstanceTypeAndBranch(value, JS_FUNCTION_TYPE); 8798 New<HHasInstanceTypeAndBranch>(value, JS_FUNCTION_TYPE);
8799 return ast_context()->ReturnControl(result, call->id()); 8799 return ast_context()->ReturnControl(result, call->id());
8800 } 8800 }
8801 8801
8802 8802
8803 void HOptimizedGraphBuilder::GenerateHasCachedArrayIndex(CallRuntime* call) { 8803 void HOptimizedGraphBuilder::GenerateHasCachedArrayIndex(CallRuntime* call) {
8804 ASSERT(call->arguments()->length() == 1); 8804 ASSERT(call->arguments()->length() == 1);
8805 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 8805 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
8806 HValue* value = Pop(); 8806 HValue* value = Pop();
8807 HHasCachedArrayIndexAndBranch* result = 8807 HHasCachedArrayIndexAndBranch* result =
8808 new(zone()) HHasCachedArrayIndexAndBranch(value); 8808 new(zone()) HHasCachedArrayIndexAndBranch(value);
8809 return ast_context()->ReturnControl(result, call->id()); 8809 return ast_context()->ReturnControl(result, call->id());
8810 } 8810 }
8811 8811
8812 8812
8813 void HOptimizedGraphBuilder::GenerateIsArray(CallRuntime* call) { 8813 void HOptimizedGraphBuilder::GenerateIsArray(CallRuntime* call) {
8814 ASSERT(call->arguments()->length() == 1); 8814 ASSERT(call->arguments()->length() == 1);
8815 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 8815 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
8816 HValue* value = Pop(); 8816 HValue* value = Pop();
8817 HHasInstanceTypeAndBranch* result = 8817 HHasInstanceTypeAndBranch* result =
8818 new(zone()) HHasInstanceTypeAndBranch(value, JS_ARRAY_TYPE); 8818 New<HHasInstanceTypeAndBranch>(value, JS_ARRAY_TYPE);
8819 return ast_context()->ReturnControl(result, call->id()); 8819 return ast_context()->ReturnControl(result, call->id());
8820 } 8820 }
8821 8821
8822 8822
8823 void HOptimizedGraphBuilder::GenerateIsRegExp(CallRuntime* call) { 8823 void HOptimizedGraphBuilder::GenerateIsRegExp(CallRuntime* call) {
8824 ASSERT(call->arguments()->length() == 1); 8824 ASSERT(call->arguments()->length() == 1);
8825 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 8825 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
8826 HValue* value = Pop(); 8826 HValue* value = Pop();
8827 HHasInstanceTypeAndBranch* result = 8827 HHasInstanceTypeAndBranch* result =
8828 new(zone()) HHasInstanceTypeAndBranch(value, JS_REGEXP_TYPE); 8828 New<HHasInstanceTypeAndBranch>(value, JS_REGEXP_TYPE);
8829 return ast_context()->ReturnControl(result, call->id()); 8829 return ast_context()->ReturnControl(result, call->id());
8830 } 8830 }
8831 8831
8832 8832
8833 void HOptimizedGraphBuilder::GenerateIsObject(CallRuntime* call) { 8833 void HOptimizedGraphBuilder::GenerateIsObject(CallRuntime* call) {
8834 ASSERT(call->arguments()->length() == 1); 8834 ASSERT(call->arguments()->length() == 1);
8835 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 8835 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
8836 HValue* value = Pop(); 8836 HValue* value = Pop();
8837 HIsObjectAndBranch* result = New<HIsObjectAndBranch>(value); 8837 HIsObjectAndBranch* result = New<HIsObjectAndBranch>(value);
8838 return ast_context()->ReturnControl(result, call->id()); 8838 return ast_context()->ReturnControl(result, call->id());
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
8972 // Check if object is a not a smi. 8972 // Check if object is a not a smi.
8973 HBasicBlock* if_smi = graph()->CreateBasicBlock(); 8973 HBasicBlock* if_smi = graph()->CreateBasicBlock();
8974 HBasicBlock* if_heap_object = graph()->CreateBasicBlock(); 8974 HBasicBlock* if_heap_object = graph()->CreateBasicBlock();
8975 HBasicBlock* join = graph()->CreateBasicBlock(); 8975 HBasicBlock* join = graph()->CreateBasicBlock();
8976 current_block()->Finish(New<HIsSmiAndBranch>(object, if_smi, if_heap_object)); 8976 current_block()->Finish(New<HIsSmiAndBranch>(object, if_smi, if_heap_object));
8977 if_smi->Goto(join); 8977 if_smi->Goto(join);
8978 8978
8979 // Check if object is a JSValue. 8979 // Check if object is a JSValue.
8980 set_current_block(if_heap_object); 8980 set_current_block(if_heap_object);
8981 HHasInstanceTypeAndBranch* typecheck = 8981 HHasInstanceTypeAndBranch* typecheck =
8982 new(zone()) HHasInstanceTypeAndBranch(object, JS_VALUE_TYPE); 8982 New<HHasInstanceTypeAndBranch>(object, JS_VALUE_TYPE);
8983 HBasicBlock* if_js_value = graph()->CreateBasicBlock(); 8983 HBasicBlock* if_js_value = graph()->CreateBasicBlock();
8984 HBasicBlock* not_js_value = graph()->CreateBasicBlock(); 8984 HBasicBlock* not_js_value = graph()->CreateBasicBlock();
8985 typecheck->SetSuccessorAt(0, if_js_value); 8985 typecheck->SetSuccessorAt(0, if_js_value);
8986 typecheck->SetSuccessorAt(1, not_js_value); 8986 typecheck->SetSuccessorAt(1, not_js_value);
8987 current_block()->Finish(typecheck); 8987 current_block()->Finish(typecheck);
8988 not_js_value->Goto(join); 8988 not_js_value->Goto(join);
8989 8989
8990 // Create in-object property store to kValueOffset. 8990 // Create in-object property store to kValueOffset.
8991 set_current_block(if_js_value); 8991 set_current_block(if_js_value);
8992 Add<HStoreNamedField>(object, 8992 Add<HStoreNamedField>(object,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
9137 9137
9138 for (int i = 0; i < arg_count; ++i) { 9138 for (int i = 0; i < arg_count; ++i) {
9139 CHECK_ALIVE(VisitArgument(call->arguments()->at(i))); 9139 CHECK_ALIVE(VisitArgument(call->arguments()->at(i)));
9140 } 9140 }
9141 CHECK_ALIVE(VisitForValue(call->arguments()->last())); 9141 CHECK_ALIVE(VisitForValue(call->arguments()->last()));
9142 9142
9143 HValue* function = Pop(); 9143 HValue* function = Pop();
9144 9144
9145 // Branch for function proxies, or other non-functions. 9145 // Branch for function proxies, or other non-functions.
9146 HHasInstanceTypeAndBranch* typecheck = 9146 HHasInstanceTypeAndBranch* typecheck =
9147 new(zone()) HHasInstanceTypeAndBranch(function, JS_FUNCTION_TYPE); 9147 New<HHasInstanceTypeAndBranch>(function, JS_FUNCTION_TYPE);
9148 HBasicBlock* if_jsfunction = graph()->CreateBasicBlock(); 9148 HBasicBlock* if_jsfunction = graph()->CreateBasicBlock();
9149 HBasicBlock* if_nonfunction = graph()->CreateBasicBlock(); 9149 HBasicBlock* if_nonfunction = graph()->CreateBasicBlock();
9150 HBasicBlock* join = graph()->CreateBasicBlock(); 9150 HBasicBlock* join = graph()->CreateBasicBlock();
9151 typecheck->SetSuccessorAt(0, if_jsfunction); 9151 typecheck->SetSuccessorAt(0, if_jsfunction);
9152 typecheck->SetSuccessorAt(1, if_nonfunction); 9152 typecheck->SetSuccessorAt(1, if_nonfunction);
9153 current_block()->Finish(typecheck); 9153 current_block()->Finish(typecheck);
9154 9154
9155 set_current_block(if_jsfunction); 9155 set_current_block(if_jsfunction);
9156 HInstruction* invoke_result = Add<HInvokeFunction>(function, arg_count); 9156 HInstruction* invoke_result = Add<HInvokeFunction>(function, arg_count);
9157 Drop(arg_count); 9157 Drop(arg_count);
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
9875 if (ShouldProduceTraceOutput()) { 9875 if (ShouldProduceTraceOutput()) {
9876 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9876 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9877 } 9877 }
9878 9878
9879 #ifdef DEBUG 9879 #ifdef DEBUG
9880 graph_->Verify(false); // No full verify. 9880 graph_->Verify(false); // No full verify.
9881 #endif 9881 #endif
9882 } 9882 }
9883 9883
9884 } } // namespace v8::internal 9884 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698