| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 998 HValue* context = environment()->LookupContext(); | 998 HValue* context = environment()->LookupContext(); |
| 999 int num_parameters = graph()->info()->num_parameters(); | 999 int num_parameters = graph()->info()->num_parameters(); |
| 1000 HValue* params = Add<HConstant>(num_parameters); | 1000 HValue* params = Add<HConstant>(num_parameters); |
| 1001 HReturn* return_instruction = new(graph()->zone()) | 1001 HReturn* return_instruction = new(graph()->zone()) |
| 1002 HReturn(value, context, params); | 1002 HReturn(value, context, params); |
| 1003 current_block()->FinishExit(return_instruction); | 1003 current_block()->FinishExit(return_instruction); |
| 1004 return return_instruction; | 1004 return return_instruction; |
| 1005 } | 1005 } |
| 1006 | 1006 |
| 1007 | 1007 |
| 1008 void HGraphBuilder::AddSoftDeoptimize() { |
| 1009 isolate()->counters()->soft_deopts_requested()->Increment(); |
| 1010 if (FLAG_always_opt) return; |
| 1011 if (current_block()->IsDeoptimizing()) return; |
| 1012 Add<HSoftDeoptimize>(); |
| 1013 isolate()->counters()->soft_deopts_inserted()->Increment(); |
| 1014 current_block()->MarkAsDeoptimizing(); |
| 1015 graph()->set_has_soft_deoptimize(true); |
| 1016 } |
| 1017 |
| 1018 |
| 1008 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { | 1019 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { |
| 1009 HBasicBlock* b = graph()->CreateBasicBlock(); | 1020 HBasicBlock* b = graph()->CreateBasicBlock(); |
| 1010 b->SetInitialEnvironment(env); | 1021 b->SetInitialEnvironment(env); |
| 1011 return b; | 1022 return b; |
| 1012 } | 1023 } |
| 1013 | 1024 |
| 1014 | 1025 |
| 1015 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { | 1026 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { |
| 1016 HBasicBlock* header = graph()->CreateBasicBlock(); | 1027 HBasicBlock* header = graph()->CreateBasicBlock(); |
| 1017 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header); | 1028 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 HInstruction* value = Add<HLoadKeyed>(boilerplate_elements, key_constant, | 1658 HInstruction* value = Add<HLoadKeyed>(boilerplate_elements, key_constant, |
| 1648 static_cast<HValue*>(NULL), kind); | 1659 static_cast<HValue*>(NULL), kind); |
| 1649 Add<HStoreKeyed>(object_elements, key_constant, value, kind); | 1660 Add<HStoreKeyed>(object_elements, key_constant, value, kind); |
| 1650 } | 1661 } |
| 1651 } | 1662 } |
| 1652 | 1663 |
| 1653 return object; | 1664 return object; |
| 1654 } | 1665 } |
| 1655 | 1666 |
| 1656 | 1667 |
| 1668 HInstruction* HGraphBuilder::BuildUnaryMathOp( |
| 1669 HValue* input, Handle<Type> type, Token::Value operation) { |
| 1670 // We only handle the numeric cases here |
| 1671 type = handle( |
| 1672 Type::Intersect(type, handle(Type::Number(), isolate())), isolate()); |
| 1673 |
| 1674 switch (operation) { |
| 1675 default: |
| 1676 UNREACHABLE(); |
| 1677 case Token::SUB: { |
| 1678 HInstruction* instr = |
| 1679 HMul::New(zone(), environment()->LookupContext(), |
| 1680 input, graph()->GetConstantMinus1()); |
| 1681 Representation rep = Representation::FromType(type); |
| 1682 if (type->Is(Type::None())) { |
| 1683 AddSoftDeoptimize(); |
| 1684 } |
| 1685 if (instr->IsBinaryOperation()) { |
| 1686 HBinaryOperation* binop = HBinaryOperation::cast(instr); |
| 1687 binop->set_observed_input_representation(1, rep); |
| 1688 binop->set_observed_input_representation(2, rep); |
| 1689 } |
| 1690 return instr; |
| 1691 } |
| 1692 case Token::BIT_NOT: |
| 1693 if (type->Is(Type::None())) { |
| 1694 AddSoftDeoptimize(); |
| 1695 } |
| 1696 return new(zone()) HBitNot(input); |
| 1697 } |
| 1698 } |
| 1699 |
| 1700 |
| 1657 void HGraphBuilder::BuildCompareNil( | 1701 void HGraphBuilder::BuildCompareNil( |
| 1658 HValue* value, | 1702 HValue* value, |
| 1659 Handle<Type> type, | 1703 Handle<Type> type, |
| 1660 int position, | 1704 int position, |
| 1661 HIfContinuation* continuation) { | 1705 HIfContinuation* continuation) { |
| 1662 IfBuilder if_nil(this, position); | 1706 IfBuilder if_nil(this, position); |
| 1663 bool needs_or = false; | 1707 bool needs_or = false; |
| 1664 if (type->Maybe(Type::Null())) { | 1708 if (type->Maybe(Type::Null())) { |
| 1665 if (needs_or) if_nil.Or(); | 1709 if (needs_or) if_nil.Or(); |
| 1666 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); | 1710 if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull()); |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1902 } | 1946 } |
| 1903 | 1947 |
| 1904 | 1948 |
| 1905 HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object, | 1949 HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object, |
| 1906 Handle<Map> map) { | 1950 Handle<Map> map) { |
| 1907 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(), | 1951 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(), |
| 1908 Add<HConstant>(map)); | 1952 Add<HConstant>(map)); |
| 1909 } | 1953 } |
| 1910 | 1954 |
| 1911 | 1955 |
| 1956 HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin, |
| 1957 HContext* context) { |
| 1958 HGlobalObject* global_object = Add<HGlobalObject>(context); |
| 1959 HObjectAccess access = HObjectAccess::ForJSObjectOffset( |
| 1960 GlobalObject::kBuiltinsOffset); |
| 1961 HValue* builtins = AddLoad(global_object, access); |
| 1962 HObjectAccess function_access = HObjectAccess::ForJSObjectOffset( |
| 1963 JSBuiltinsObject::OffsetOfFunctionWithId(builtin)); |
| 1964 return AddLoad(builtins, function_access); |
| 1965 } |
| 1966 |
| 1967 |
| 1912 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info) | 1968 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info) |
| 1913 : HGraphBuilder(info), | 1969 : HGraphBuilder(info), |
| 1914 function_state_(NULL), | 1970 function_state_(NULL), |
| 1915 initial_function_state_(this, info, NORMAL_RETURN), | 1971 initial_function_state_(this, info, NORMAL_RETURN), |
| 1916 ast_context_(NULL), | 1972 ast_context_(NULL), |
| 1917 break_scope_(NULL), | 1973 break_scope_(NULL), |
| 1918 inlined_count_(0), | 1974 inlined_count_(0), |
| 1919 globals_(10, info->zone()), | 1975 globals_(10, info->zone()), |
| 1920 inline_bailout_(false), | 1976 inline_bailout_(false), |
| 1921 osr_(new(info->zone()) HOsrBuilder(this)) { | 1977 osr_(new(info->zone()) HOsrBuilder(this)) { |
| (...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4060 } | 4116 } |
| 4061 } | 4117 } |
| 4062 | 4118 |
| 4063 | 4119 |
| 4064 void HOptimizedGraphBuilder::PushAndAdd(HInstruction* instr) { | 4120 void HOptimizedGraphBuilder::PushAndAdd(HInstruction* instr) { |
| 4065 Push(instr); | 4121 Push(instr); |
| 4066 AddInstruction(instr); | 4122 AddInstruction(instr); |
| 4067 } | 4123 } |
| 4068 | 4124 |
| 4069 | 4125 |
| 4070 void HOptimizedGraphBuilder::AddSoftDeoptimize() { | |
| 4071 isolate()->counters()->soft_deopts_requested()->Increment(); | |
| 4072 if (FLAG_always_opt) return; | |
| 4073 if (current_block()->IsDeoptimizing()) return; | |
| 4074 Add<HSoftDeoptimize>(); | |
| 4075 isolate()->counters()->soft_deopts_inserted()->Increment(); | |
| 4076 current_block()->MarkAsDeoptimizing(); | |
| 4077 graph()->set_has_soft_deoptimize(true); | |
| 4078 } | |
| 4079 | |
| 4080 | |
| 4081 template <class Instruction> | 4126 template <class Instruction> |
| 4082 HInstruction* HOptimizedGraphBuilder::PreProcessCall(Instruction* call) { | 4127 HInstruction* HOptimizedGraphBuilder::PreProcessCall(Instruction* call) { |
| 4083 int count = call->argument_count(); | 4128 int count = call->argument_count(); |
| 4084 ZoneList<HValue*> arguments(count, zone()); | 4129 ZoneList<HValue*> arguments(count, zone()); |
| 4085 for (int i = 0; i < count; ++i) { | 4130 for (int i = 0; i < count; ++i) { |
| 4086 arguments.Add(Pop(), zone()); | 4131 arguments.Add(Pop(), zone()); |
| 4087 } | 4132 } |
| 4088 | 4133 |
| 4089 while (!arguments.is_empty()) { | 4134 while (!arguments.is_empty()) { |
| 4090 Add<HPushArgument>(arguments.RemoveLast()); | 4135 Add<HPushArgument>(arguments.RemoveLast()); |
| (...skipping 4194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8285 HValue* value = Pop(); | 8330 HValue* value = Pop(); |
| 8286 HValue* context = environment()->LookupContext(); | 8331 HValue* context = environment()->LookupContext(); |
| 8287 HInstruction* instr = new(zone()) HTypeof(context, value); | 8332 HInstruction* instr = new(zone()) HTypeof(context, value); |
| 8288 return ast_context()->ReturnInstruction(instr, expr->id()); | 8333 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 8289 } | 8334 } |
| 8290 | 8335 |
| 8291 | 8336 |
| 8292 void HOptimizedGraphBuilder::VisitSub(UnaryOperation* expr) { | 8337 void HOptimizedGraphBuilder::VisitSub(UnaryOperation* expr) { |
| 8293 CHECK_ALIVE(VisitForValue(expr->expression())); | 8338 CHECK_ALIVE(VisitForValue(expr->expression())); |
| 8294 HValue* value = Pop(); | 8339 HValue* value = Pop(); |
| 8295 HValue* context = environment()->LookupContext(); | |
| 8296 HInstruction* instr = | |
| 8297 HMul::New(zone(), context, value, graph()->GetConstantMinus1()); | |
| 8298 Handle<Type> operand_type = expr->expression()->lower_type(); | 8340 Handle<Type> operand_type = expr->expression()->lower_type(); |
| 8299 Representation rep = ToRepresentation(operand_type); | 8341 HInstruction* instr = BuildUnaryMathOp(value, operand_type, Token::SUB); |
| 8300 if (operand_type->Is(Type::None())) { | |
| 8301 AddSoftDeoptimize(); | |
| 8302 } | |
| 8303 if (instr->IsBinaryOperation()) { | |
| 8304 HBinaryOperation::cast(instr)->set_observed_input_representation(1, rep); | |
| 8305 HBinaryOperation::cast(instr)->set_observed_input_representation(2, rep); | |
| 8306 } | |
| 8307 return ast_context()->ReturnInstruction(instr, expr->id()); | 8342 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 8308 } | 8343 } |
| 8309 | 8344 |
| 8310 | 8345 |
| 8311 void HOptimizedGraphBuilder::VisitBitNot(UnaryOperation* expr) { | 8346 void HOptimizedGraphBuilder::VisitBitNot(UnaryOperation* expr) { |
| 8312 CHECK_ALIVE(VisitForValue(expr->expression())); | 8347 CHECK_ALIVE(VisitForValue(expr->expression())); |
| 8313 HValue* value = Pop(); | 8348 HValue* value = Pop(); |
| 8314 Handle<Type> operand_type = expr->expression()->lower_type(); | 8349 Handle<Type> operand_type = expr->expression()->lower_type(); |
| 8315 if (operand_type->Is(Type::None())) { | 8350 HInstruction* instr = BuildUnaryMathOp(value, operand_type, Token::BIT_NOT); |
| 8316 AddSoftDeoptimize(); | |
| 8317 } | |
| 8318 HInstruction* instr = new(zone()) HBitNot(value); | |
| 8319 return ast_context()->ReturnInstruction(instr, expr->id()); | 8351 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 8320 } | 8352 } |
| 8321 | 8353 |
| 8322 | 8354 |
| 8323 void HOptimizedGraphBuilder::VisitNot(UnaryOperation* expr) { | 8355 void HOptimizedGraphBuilder::VisitNot(UnaryOperation* expr) { |
| 8324 if (ast_context()->IsTest()) { | 8356 if (ast_context()->IsTest()) { |
| 8325 TestContext* context = TestContext::cast(ast_context()); | 8357 TestContext* context = TestContext::cast(ast_context()); |
| 8326 VisitForControl(expr->expression(), | 8358 VisitForControl(expr->expression(), |
| 8327 context->if_false(), | 8359 context->if_false(), |
| 8328 context->if_true()); | 8360 context->if_true()); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8362 set_current_block(join); | 8394 set_current_block(join); |
| 8363 if (join != NULL) return ast_context()->ReturnValue(Pop()); | 8395 if (join != NULL) return ast_context()->ReturnValue(Pop()); |
| 8364 } | 8396 } |
| 8365 | 8397 |
| 8366 | 8398 |
| 8367 HInstruction* HOptimizedGraphBuilder::BuildIncrement( | 8399 HInstruction* HOptimizedGraphBuilder::BuildIncrement( |
| 8368 bool returns_original_input, | 8400 bool returns_original_input, |
| 8369 CountOperation* expr) { | 8401 CountOperation* expr) { |
| 8370 // The input to the count operation is on top of the expression stack. | 8402 // The input to the count operation is on top of the expression stack. |
| 8371 TypeInfo info = expr->type(); | 8403 TypeInfo info = expr->type(); |
| 8372 Representation rep = ToRepresentation(info); | 8404 Representation rep = Representation::FromType(info); |
| 8373 if (rep.IsNone() || rep.IsTagged()) { | 8405 if (rep.IsNone() || rep.IsTagged()) { |
| 8374 rep = Representation::Smi(); | 8406 rep = Representation::Smi(); |
| 8375 } | 8407 } |
| 8376 | 8408 |
| 8377 if (returns_original_input) { | 8409 if (returns_original_input) { |
| 8378 // We need an explicit HValue representing ToNumber(input). The | 8410 // We need an explicit HValue representing ToNumber(input). The |
| 8379 // actual HChange instruction we need is (sometimes) added in a later | 8411 // actual HChange instruction we need is (sometimes) added in a later |
| 8380 // phase, so it is not available now to be used as an input to HAdd and | 8412 // phase, so it is not available now to be used as an input to HAdd and |
| 8381 // as the return value. | 8413 // as the return value. |
| 8382 HInstruction* number_input = Add<HForceRepresentation>(Pop(), rep); | 8414 HInstruction* number_input = Add<HForceRepresentation>(Pop(), rep); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8670 | 8702 |
| 8671 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( | 8703 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( |
| 8672 BinaryOperation* expr, | 8704 BinaryOperation* expr, |
| 8673 HValue* left, | 8705 HValue* left, |
| 8674 HValue* right) { | 8706 HValue* right) { |
| 8675 HValue* context = environment()->LookupContext(); | 8707 HValue* context = environment()->LookupContext(); |
| 8676 Handle<Type> left_type = expr->left()->lower_type(); | 8708 Handle<Type> left_type = expr->left()->lower_type(); |
| 8677 Handle<Type> right_type = expr->right()->lower_type(); | 8709 Handle<Type> right_type = expr->right()->lower_type(); |
| 8678 Handle<Type> result_type = expr->lower_type(); | 8710 Handle<Type> result_type = expr->lower_type(); |
| 8679 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); | 8711 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); |
| 8680 Representation left_rep = ToRepresentation(left_type); | 8712 Representation left_rep = Representation::FromType(left_type); |
| 8681 Representation right_rep = ToRepresentation(right_type); | 8713 Representation right_rep = Representation::FromType(right_type); |
| 8682 Representation result_rep = ToRepresentation(result_type); | 8714 Representation result_rep = Representation::FromType(result_type); |
| 8715 |
| 8683 if (left_type->Is(Type::None())) { | 8716 if (left_type->Is(Type::None())) { |
| 8684 AddSoftDeoptimize(); | 8717 AddSoftDeoptimize(); |
| 8685 // TODO(rossberg): we should be able to get rid of non-continuous defaults. | 8718 // TODO(rossberg): we should be able to get rid of non-continuous defaults. |
| 8686 left_type = handle(Type::Any(), isolate()); | 8719 left_type = handle(Type::Any(), isolate()); |
| 8687 } | 8720 } |
| 8688 if (right_type->Is(Type::None())) { | 8721 if (right_type->Is(Type::None())) { |
| 8689 AddSoftDeoptimize(); | 8722 AddSoftDeoptimize(); |
| 8690 right_type = handle(Type::Any(), isolate()); | 8723 right_type = handle(Type::Any(), isolate()); |
| 8691 } | 8724 } |
| 8692 HInstruction* instr = NULL; | 8725 HInstruction* instr = NULL; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8900 CHECK_ALIVE(VisitForValue(expr->left())); | 8933 CHECK_ALIVE(VisitForValue(expr->left())); |
| 8901 CHECK_ALIVE(VisitForValue(expr->right())); | 8934 CHECK_ALIVE(VisitForValue(expr->right())); |
| 8902 HValue* right = Pop(); | 8935 HValue* right = Pop(); |
| 8903 HValue* left = Pop(); | 8936 HValue* left = Pop(); |
| 8904 HInstruction* instr = BuildBinaryOperation(expr, left, right); | 8937 HInstruction* instr = BuildBinaryOperation(expr, left, right); |
| 8905 instr->set_position(expr->position()); | 8938 instr->set_position(expr->position()); |
| 8906 return ast_context()->ReturnInstruction(instr, expr->id()); | 8939 return ast_context()->ReturnInstruction(instr, expr->id()); |
| 8907 } | 8940 } |
| 8908 | 8941 |
| 8909 | 8942 |
| 8910 // TODO(rossberg): this should die eventually. | |
| 8911 Representation HOptimizedGraphBuilder::ToRepresentation(TypeInfo info) { | |
| 8912 if (info.IsUninitialized()) return Representation::None(); | |
| 8913 // TODO(verwaest): Return Smi rather than Integer32. | |
| 8914 if (info.IsSmi()) return Representation::Integer32(); | |
| 8915 if (info.IsInteger32()) return Representation::Integer32(); | |
| 8916 if (info.IsDouble()) return Representation::Double(); | |
| 8917 if (info.IsNumber()) return Representation::Double(); | |
| 8918 return Representation::Tagged(); | |
| 8919 } | |
| 8920 | |
| 8921 | |
| 8922 Representation HOptimizedGraphBuilder::ToRepresentation(Handle<Type> type) { | |
| 8923 if (type->Is(Type::None())) return Representation::None(); | |
| 8924 if (type->Is(Type::Signed32())) return Representation::Integer32(); | |
| 8925 if (type->Is(Type::Number())) return Representation::Double(); | |
| 8926 return Representation::Tagged(); | |
| 8927 } | |
| 8928 | |
| 8929 | |
| 8930 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, | 8943 void HOptimizedGraphBuilder::HandleLiteralCompareTypeof(CompareOperation* expr, |
| 8931 HTypeof* typeof_expr, | 8944 HTypeof* typeof_expr, |
| 8932 Handle<String> check) { | 8945 Handle<String> check) { |
| 8933 // Note: The HTypeof itself is removed during canonicalization, if possible. | 8946 // Note: The HTypeof itself is removed during canonicalization, if possible. |
| 8934 HValue* value = typeof_expr->value(); | 8947 HValue* value = typeof_expr->value(); |
| 8935 HTypeofIsAndBranch* instr = new(zone()) HTypeofIsAndBranch(value, check); | 8948 HTypeofIsAndBranch* instr = new(zone()) HTypeofIsAndBranch(value, check); |
| 8936 instr->set_position(expr->position()); | 8949 instr->set_position(expr->position()); |
| 8937 return ast_context()->ReturnControl(instr, expr->id()); | 8950 return ast_context()->ReturnControl(instr, expr->id()); |
| 8938 } | 8951 } |
| 8939 | 8952 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9012 Handle<String> rhs = Handle<String>::cast(literal->value()); | 9025 Handle<String> rhs = Handle<String>::cast(literal->value()); |
| 9013 HClassOfTestAndBranch* instr = | 9026 HClassOfTestAndBranch* instr = |
| 9014 new(zone()) HClassOfTestAndBranch(value, rhs); | 9027 new(zone()) HClassOfTestAndBranch(value, rhs); |
| 9015 instr->set_position(expr->position()); | 9028 instr->set_position(expr->position()); |
| 9016 return ast_context()->ReturnControl(instr, expr->id()); | 9029 return ast_context()->ReturnControl(instr, expr->id()); |
| 9017 } | 9030 } |
| 9018 | 9031 |
| 9019 Handle<Type> left_type = expr->left()->lower_type(); | 9032 Handle<Type> left_type = expr->left()->lower_type(); |
| 9020 Handle<Type> right_type = expr->right()->lower_type(); | 9033 Handle<Type> right_type = expr->right()->lower_type(); |
| 9021 Handle<Type> combined_type = expr->combined_type(); | 9034 Handle<Type> combined_type = expr->combined_type(); |
| 9022 Representation combined_rep = ToRepresentation(combined_type); | 9035 Representation combined_rep = Representation::FromType(combined_type); |
| 9023 Representation left_rep = ToRepresentation(left_type); | 9036 Representation left_rep = Representation::FromType(left_type); |
| 9024 Representation right_rep = ToRepresentation(right_type); | 9037 Representation right_rep = Representation::FromType(right_type); |
| 9025 | 9038 |
| 9026 CHECK_ALIVE(VisitForValue(expr->left())); | 9039 CHECK_ALIVE(VisitForValue(expr->left())); |
| 9027 CHECK_ALIVE(VisitForValue(expr->right())); | 9040 CHECK_ALIVE(VisitForValue(expr->right())); |
| 9028 | 9041 |
| 9029 HValue* context = environment()->LookupContext(); | 9042 HValue* context = environment()->LookupContext(); |
| 9030 HValue* right = Pop(); | 9043 HValue* right = Pop(); |
| 9031 HValue* left = Pop(); | 9044 HValue* left = Pop(); |
| 9032 Token::Value op = expr->op(); | 9045 Token::Value op = expr->op(); |
| 9033 | 9046 |
| 9034 HTypeof* typeof_expr = NULL; | 9047 HTypeof* typeof_expr = NULL; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9143 return ast_context()->ReturnControl(result, expr->id()); | 9156 return ast_context()->ReturnControl(result, expr->id()); |
| 9144 } else { | 9157 } else { |
| 9145 if (combined_rep.IsTagged() || combined_rep.IsNone()) { | 9158 if (combined_rep.IsTagged() || combined_rep.IsNone()) { |
| 9146 HCompareGeneric* result = | 9159 HCompareGeneric* result = |
| 9147 new(zone()) HCompareGeneric(context, left, right, op); | 9160 new(zone()) HCompareGeneric(context, left, right, op); |
| 9148 result->set_observed_input_representation(1, left_rep); | 9161 result->set_observed_input_representation(1, left_rep); |
| 9149 result->set_observed_input_representation(2, right_rep); | 9162 result->set_observed_input_representation(2, right_rep); |
| 9150 result->set_position(expr->position()); | 9163 result->set_position(expr->position()); |
| 9151 return ast_context()->ReturnInstruction(result, expr->id()); | 9164 return ast_context()->ReturnInstruction(result, expr->id()); |
| 9152 } else { | 9165 } else { |
| 9153 // TODO(verwaest): Remove once ToRepresentation properly returns Smi when | 9166 // TODO(verwaest): Remove once Representation::FromType properly |
| 9154 // the IC measures Smi. | 9167 // returns Smi when the IC measures Smi. |
| 9155 if (left_type->Is(Type::Smi())) left_rep = Representation::Smi(); | 9168 if (left_type->Is(Type::Smi())) left_rep = Representation::Smi(); |
| 9156 if (right_type->Is(Type::Smi())) right_rep = Representation::Smi(); | 9169 if (right_type->Is(Type::Smi())) right_rep = Representation::Smi(); |
| 9157 HCompareIDAndBranch* result = | 9170 HCompareIDAndBranch* result = |
| 9158 new(zone()) HCompareIDAndBranch(left, right, op); | 9171 new(zone()) HCompareIDAndBranch(left, right, op); |
| 9159 result->set_observed_input_representation(left_rep, right_rep); | 9172 result->set_observed_input_representation(left_rep, right_rep); |
| 9160 result->set_position(expr->position()); | 9173 result->set_position(expr->position()); |
| 9161 return ast_context()->ReturnControl(result, expr->id()); | 9174 return ast_context()->ReturnControl(result, expr->id()); |
| 9162 } | 9175 } |
| 9163 } | 9176 } |
| 9164 } | 9177 } |
| (...skipping 1639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10804 if (ShouldProduceTraceOutput()) { | 10817 if (ShouldProduceTraceOutput()) { |
| 10805 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10818 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 10806 } | 10819 } |
| 10807 | 10820 |
| 10808 #ifdef DEBUG | 10821 #ifdef DEBUG |
| 10809 graph_->Verify(false); // No full verify. | 10822 graph_->Verify(false); // No full verify. |
| 10810 #endif | 10823 #endif |
| 10811 } | 10824 } |
| 10812 | 10825 |
| 10813 } } // namespace v8::internal | 10826 } } // namespace v8::internal |
| OLD | NEW |