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

Side by Side Diff: src/hydrogen.cc

Issue 18415005: Introduce type Bounds record (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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 | « src/ast.h ('k') | src/types.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 7331 matching lines...) Expand 10 before | Expand all | Expand 10 after
7342 return; 7342 return;
7343 7343
7344 } else { 7344 } else {
7345 HValue* context = environment()->LookupContext(); 7345 HValue* context = environment()->LookupContext();
7346 call = PreProcessCall( 7346 call = PreProcessCall(
7347 new(zone()) HCallNamed(context, name, argument_count)); 7347 new(zone()) HCallNamed(context, name, argument_count));
7348 } 7348 }
7349 7349
7350 } else { 7350 } else {
7351 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 7351 VariableProxy* proxy = expr->expression()->AsVariableProxy();
7352 bool global_call = proxy != NULL && proxy->var()->IsUnallocated();
7353
7354 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) { 7352 if (proxy != NULL && proxy->var()->is_possibly_eval(isolate())) {
7355 return Bailout("possible direct call to eval"); 7353 return Bailout("possible direct call to eval");
7356 } 7354 }
7357 7355
7356 bool global_call = proxy != NULL && proxy->var()->IsUnallocated();
7358 if (global_call) { 7357 if (global_call) {
7359 Variable* var = proxy->var(); 7358 Variable* var = proxy->var();
7360 bool known_global_function = false; 7359 bool known_global_function = false;
7361 // If there is a global property cell for the name at compile time and 7360 // If there is a global property cell for the name at compile time and
7362 // access check is not enabled we assume that the function will not change 7361 // access check is not enabled we assume that the function will not change
7363 // and generate optimized code for calling the function. 7362 // and generate optimized code for calling the function.
7364 LookupResult lookup(isolate()); 7363 LookupResult lookup(isolate());
7365 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false); 7364 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false);
7366 if (type == kUseCell && 7365 if (type == kUseCell &&
7367 !current_info()->global_object()->IsAccessCheckNeeded()) { 7366 !current_info()->global_object()->IsAccessCheckNeeded()) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
7665 HValue* value = Pop(); 7664 HValue* value = Pop();
7666 HValue* context = environment()->LookupContext(); 7665 HValue* context = environment()->LookupContext();
7667 HInstruction* instr = new(zone()) HTypeof(context, value); 7666 HInstruction* instr = new(zone()) HTypeof(context, value);
7668 return ast_context()->ReturnInstruction(instr, expr->id()); 7667 return ast_context()->ReturnInstruction(instr, expr->id());
7669 } 7668 }
7670 7669
7671 7670
7672 void HOptimizedGraphBuilder::VisitSub(UnaryOperation* expr) { 7671 void HOptimizedGraphBuilder::VisitSub(UnaryOperation* expr) {
7673 CHECK_ALIVE(VisitForValue(expr->expression())); 7672 CHECK_ALIVE(VisitForValue(expr->expression()));
7674 HValue* value = Pop(); 7673 HValue* value = Pop();
7675 Handle<Type> operand_type = expr->expression()->lower_type(); 7674 Handle<Type> operand_type = expr->expression()->bounds().lower;
7676 HInstruction* instr = BuildUnaryMathOp(value, operand_type, Token::SUB); 7675 HInstruction* instr = BuildUnaryMathOp(value, operand_type, Token::SUB);
7677 return ast_context()->ReturnInstruction(instr, expr->id()); 7676 return ast_context()->ReturnInstruction(instr, expr->id());
7678 } 7677 }
7679 7678
7680 7679
7681 void HOptimizedGraphBuilder::VisitBitNot(UnaryOperation* expr) { 7680 void HOptimizedGraphBuilder::VisitBitNot(UnaryOperation* expr) {
7682 CHECK_ALIVE(VisitForValue(expr->expression())); 7681 CHECK_ALIVE(VisitForValue(expr->expression()));
7683 HValue* value = Pop(); 7682 HValue* value = Pop();
7684 Handle<Type> operand_type = expr->expression()->lower_type(); 7683 Handle<Type> operand_type = expr->expression()->bounds().lower;
7685 HInstruction* instr = BuildUnaryMathOp(value, operand_type, Token::BIT_NOT); 7684 HInstruction* instr = BuildUnaryMathOp(value, operand_type, Token::BIT_NOT);
7686 return ast_context()->ReturnInstruction(instr, expr->id()); 7685 return ast_context()->ReturnInstruction(instr, expr->id());
7687 } 7686 }
7688 7687
7689 7688
7690 void HOptimizedGraphBuilder::VisitNot(UnaryOperation* expr) { 7689 void HOptimizedGraphBuilder::VisitNot(UnaryOperation* expr) {
7691 if (ast_context()->IsTest()) { 7690 if (ast_context()->IsTest()) {
7692 TestContext* context = TestContext::cast(ast_context()); 7691 TestContext* context = TestContext::cast(ast_context());
7693 VisitForControl(expr->expression(), 7692 VisitForControl(expr->expression(),
7694 context->if_false(), 7693 context->if_false(),
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
8034 } 8033 }
8035 return true; 8034 return true;
8036 } 8035 }
8037 8036
8038 8037
8039 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation( 8038 HInstruction* HOptimizedGraphBuilder::BuildBinaryOperation(
8040 BinaryOperation* expr, 8039 BinaryOperation* expr,
8041 HValue* left, 8040 HValue* left,
8042 HValue* right) { 8041 HValue* right) {
8043 HValue* context = environment()->LookupContext(); 8042 HValue* context = environment()->LookupContext();
8044 Handle<Type> left_type = expr->left()->lower_type(); 8043 Handle<Type> left_type = expr->left()->bounds().lower;
8045 Handle<Type> right_type = expr->right()->lower_type(); 8044 Handle<Type> right_type = expr->right()->bounds().lower;
8046 Handle<Type> result_type = expr->lower_type(); 8045 Handle<Type> result_type = expr->bounds().lower;
8047 Maybe<int> fixed_right_arg = expr->fixed_right_arg(); 8046 Maybe<int> fixed_right_arg = expr->fixed_right_arg();
8048 Representation left_rep = Representation::FromType(left_type); 8047 Representation left_rep = Representation::FromType(left_type);
8049 Representation right_rep = Representation::FromType(right_type); 8048 Representation right_rep = Representation::FromType(right_type);
8050 Representation result_rep = Representation::FromType(result_type); 8049 Representation result_rep = Representation::FromType(result_type);
8051 8050
8052 if (left_type->Is(Type::None())) { 8051 if (left_type->Is(Type::None())) {
8053 AddSoftDeoptimize(); 8052 AddSoftDeoptimize();
8054 // TODO(rossberg): we should be able to get rid of non-continuous defaults. 8053 // TODO(rossberg): we should be able to get rid of non-continuous defaults.
8055 left_type = handle(Type::Any(), isolate()); 8054 left_type = handle(Type::Any(), isolate());
8056 } 8055 }
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
8358 CHECK_ALIVE(VisitForValue(call->arguments()->at(0))); 8357 CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
8359 HValue* value = Pop(); 8358 HValue* value = Pop();
8360 Literal* literal = expr->right()->AsLiteral(); 8359 Literal* literal = expr->right()->AsLiteral();
8361 Handle<String> rhs = Handle<String>::cast(literal->value()); 8360 Handle<String> rhs = Handle<String>::cast(literal->value());
8362 HClassOfTestAndBranch* instr = 8361 HClassOfTestAndBranch* instr =
8363 new(zone()) HClassOfTestAndBranch(value, rhs); 8362 new(zone()) HClassOfTestAndBranch(value, rhs);
8364 instr->set_position(expr->position()); 8363 instr->set_position(expr->position());
8365 return ast_context()->ReturnControl(instr, expr->id()); 8364 return ast_context()->ReturnControl(instr, expr->id());
8366 } 8365 }
8367 8366
8368 Handle<Type> left_type = expr->left()->lower_type(); 8367 Handle<Type> left_type = expr->left()->bounds().lower;
8369 Handle<Type> right_type = expr->right()->lower_type(); 8368 Handle<Type> right_type = expr->right()->bounds().lower;
8370 Handle<Type> combined_type = expr->combined_type(); 8369 Handle<Type> combined_type = expr->combined_type();
8371 Representation combined_rep = Representation::FromType(combined_type); 8370 Representation combined_rep = Representation::FromType(combined_type);
8372 Representation left_rep = Representation::FromType(left_type); 8371 Representation left_rep = Representation::FromType(left_type);
8373 Representation right_rep = Representation::FromType(right_type); 8372 Representation right_rep = Representation::FromType(right_type);
8374 8373
8375 CHECK_ALIVE(VisitForValue(expr->left())); 8374 CHECK_ALIVE(VisitForValue(expr->left()));
8376 CHECK_ALIVE(VisitForValue(expr->right())); 8375 CHECK_ALIVE(VisitForValue(expr->right()));
8377 8376
8378 HValue* context = environment()->LookupContext(); 8377 HValue* context = environment()->LookupContext();
8379 HValue* right = Pop(); 8378 HValue* right = Pop();
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after
10176 if (ShouldProduceTraceOutput()) { 10175 if (ShouldProduceTraceOutput()) {
10177 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 10176 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
10178 } 10177 }
10179 10178
10180 #ifdef DEBUG 10179 #ifdef DEBUG
10181 graph_->Verify(false); // No full verify. 10180 graph_->Verify(false); // No full verify.
10182 #endif 10181 #endif
10183 } 10182 }
10184 10183
10185 } } // namespace v8::internal 10184 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698