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

Side by Side Diff: src/hydrogen.cc

Issue 23697002: Implement proper map checks of captured objects. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Toon Verwaest. Created 7 years, 3 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/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-escape-analysis.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 7061 matching lines...) Expand 10 before | Expand all | Expand 10 after
7072 if (known_global_function) { 7072 if (known_global_function) {
7073 // Push the global object instead of the global receiver because 7073 // Push the global object instead of the global receiver because
7074 // code generated by the full code generator expects it. 7074 // code generated by the full code generator expects it.
7075 HValue* context = environment()->context(); 7075 HValue* context = environment()->context();
7076 HGlobalObject* global_object = new(zone()) HGlobalObject(context); 7076 HGlobalObject* global_object = new(zone()) HGlobalObject(context);
7077 PushAndAdd(global_object); 7077 PushAndAdd(global_object);
7078 CHECK_ALIVE(VisitExpressions(expr->arguments())); 7078 CHECK_ALIVE(VisitExpressions(expr->arguments()));
7079 7079
7080 CHECK_ALIVE(VisitForValue(expr->expression())); 7080 CHECK_ALIVE(VisitForValue(expr->expression()));
7081 HValue* function = Pop(); 7081 HValue* function = Pop();
7082 Add<HCheckFunction>(function, expr->target()); 7082 Add<HCheckValue>(function, expr->target());
7083 7083
7084 // Replace the global object with the global receiver. 7084 // Replace the global object with the global receiver.
7085 HGlobalReceiver* global_receiver = Add<HGlobalReceiver>(global_object); 7085 HGlobalReceiver* global_receiver = Add<HGlobalReceiver>(global_object);
7086 // Index of the receiver from the top of the expression stack. 7086 // Index of the receiver from the top of the expression stack.
7087 const int receiver_index = argument_count - 1; 7087 const int receiver_index = argument_count - 1;
7088 ASSERT(environment()->ExpressionStackAt(receiver_index)-> 7088 ASSERT(environment()->ExpressionStackAt(receiver_index)->
7089 IsGlobalObject()); 7089 IsGlobalObject());
7090 environment()->SetExpressionStackAt(receiver_index, global_receiver); 7090 environment()->SetExpressionStackAt(receiver_index, global_receiver);
7091 7091
7092 if (TryInlineBuiltinFunctionCall(expr, false)) { // Nothing to drop. 7092 if (TryInlineBuiltinFunctionCall(expr, false)) { // Nothing to drop.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
7124 7124
7125 } else if (expr->IsMonomorphic()) { 7125 } else if (expr->IsMonomorphic()) {
7126 // The function is on the stack in the unoptimized code during 7126 // The function is on the stack in the unoptimized code during
7127 // evaluation of the arguments. 7127 // evaluation of the arguments.
7128 CHECK_ALIVE(VisitForValue(expr->expression())); 7128 CHECK_ALIVE(VisitForValue(expr->expression()));
7129 HValue* function = Top(); 7129 HValue* function = Top();
7130 HGlobalObject* global = Add<HGlobalObject>(); 7130 HGlobalObject* global = Add<HGlobalObject>();
7131 HGlobalReceiver* receiver = New<HGlobalReceiver>(global); 7131 HGlobalReceiver* receiver = New<HGlobalReceiver>(global);
7132 PushAndAdd(receiver); 7132 PushAndAdd(receiver);
7133 CHECK_ALIVE(VisitExpressions(expr->arguments())); 7133 CHECK_ALIVE(VisitExpressions(expr->arguments()));
7134 Add<HCheckFunction>(function, expr->target()); 7134 Add<HCheckValue>(function, expr->target());
7135 7135
7136 if (TryInlineBuiltinFunctionCall(expr, true)) { // Drop the function. 7136 if (TryInlineBuiltinFunctionCall(expr, true)) { // Drop the function.
7137 if (FLAG_trace_inlining) { 7137 if (FLAG_trace_inlining) {
7138 PrintF("Inlining builtin "); 7138 PrintF("Inlining builtin ");
7139 expr->target()->ShortPrint(); 7139 expr->target()->ShortPrint();
7140 PrintF("\n"); 7140 PrintF("\n");
7141 } 7141 }
7142 return; 7142 return;
7143 } 7143 }
7144 7144
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
7187 7187
7188 if (FLAG_inline_construct && 7188 if (FLAG_inline_construct &&
7189 expr->IsMonomorphic() && 7189 expr->IsMonomorphic() &&
7190 IsAllocationInlineable(expr->target())) { 7190 IsAllocationInlineable(expr->target())) {
7191 // The constructor function is on the stack in the unoptimized code 7191 // The constructor function is on the stack in the unoptimized code
7192 // during evaluation of the arguments. 7192 // during evaluation of the arguments.
7193 CHECK_ALIVE(VisitForValue(expr->expression())); 7193 CHECK_ALIVE(VisitForValue(expr->expression()));
7194 HValue* function = Top(); 7194 HValue* function = Top();
7195 CHECK_ALIVE(VisitExpressions(expr->arguments())); 7195 CHECK_ALIVE(VisitExpressions(expr->arguments()));
7196 Handle<JSFunction> constructor = expr->target(); 7196 Handle<JSFunction> constructor = expr->target();
7197 HValue* check = Add<HCheckFunction>(function, constructor); 7197 HValue* check = Add<HCheckValue>(function, constructor);
7198 7198
7199 // Force completion of inobject slack tracking before generating 7199 // Force completion of inobject slack tracking before generating
7200 // allocation code to finalize instance size. 7200 // allocation code to finalize instance size.
7201 if (constructor->shared()->IsInobjectSlackTrackingInProgress()) { 7201 if (constructor->shared()->IsInobjectSlackTrackingInProgress()) {
7202 constructor->shared()->CompleteInobjectSlackTracking(); 7202 constructor->shared()->CompleteInobjectSlackTracking();
7203 } 7203 }
7204 7204
7205 // Calculate instance size from initial map of constructor. 7205 // Calculate instance size from initial map of constructor.
7206 ASSERT(constructor->has_initial_map()); 7206 ASSERT(constructor->has_initial_map());
7207 Handle<Map> initial_map(constructor->initial_map()); 7207 Handle<Map> initial_map(constructor->initial_map());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
7279 // The constructor function is both an operand to the instruction and an 7279 // The constructor function is both an operand to the instruction and an
7280 // argument to the construct call. 7280 // argument to the construct call.
7281 Handle<JSFunction> array_function( 7281 Handle<JSFunction> array_function(
7282 isolate()->global_context()->array_function(), isolate()); 7282 isolate()->global_context()->array_function(), isolate());
7283 CHECK_ALIVE(VisitArgument(expr->expression())); 7283 CHECK_ALIVE(VisitArgument(expr->expression()));
7284 HValue* constructor = HPushArgument::cast(Top())->argument(); 7284 HValue* constructor = HPushArgument::cast(Top())->argument();
7285 CHECK_ALIVE(VisitArgumentList(expr->arguments())); 7285 CHECK_ALIVE(VisitArgumentList(expr->arguments()));
7286 HBinaryCall* call; 7286 HBinaryCall* call;
7287 if (expr->target().is_identical_to(array_function)) { 7287 if (expr->target().is_identical_to(array_function)) {
7288 Handle<Cell> cell = expr->allocation_info_cell(); 7288 Handle<Cell> cell = expr->allocation_info_cell();
7289 Add<HCheckFunction>(constructor, array_function); 7289 Add<HCheckValue>(constructor, array_function);
7290 call = new(zone()) HCallNewArray(context, constructor, argument_count, 7290 call = new(zone()) HCallNewArray(context, constructor, argument_count,
7291 cell, expr->elements_kind()); 7291 cell, expr->elements_kind());
7292 } else { 7292 } else {
7293 call = new(zone()) HCallNew(context, constructor, argument_count); 7293 call = new(zone()) HCallNew(context, constructor, argument_count);
7294 } 7294 }
7295 Drop(argument_count); 7295 Drop(argument_count);
7296 call->set_position(expr->position()); 7296 call->set_position(expr->position());
7297 return ast_context()->ReturnInstruction(call, expr->id()); 7297 return ast_context()->ReturnInstruction(call, expr->id());
7298 } 7298 }
7299 } 7299 }
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
8106 } 8106 }
8107 } 8107 }
8108 8108
8109 // If the target is not null we have found a known global function that is 8109 // If the target is not null we have found a known global function that is
8110 // assumed to stay the same for this instanceof. 8110 // assumed to stay the same for this instanceof.
8111 if (target.is_null()) { 8111 if (target.is_null()) {
8112 HInstanceOf* result = new(zone()) HInstanceOf(context, left, right); 8112 HInstanceOf* result = new(zone()) HInstanceOf(context, left, right);
8113 result->set_position(expr->position()); 8113 result->set_position(expr->position());
8114 return ast_context()->ReturnInstruction(result, expr->id()); 8114 return ast_context()->ReturnInstruction(result, expr->id());
8115 } else { 8115 } else {
8116 Add<HCheckFunction>(right, target); 8116 Add<HCheckValue>(right, target);
8117 HInstanceOfKnownGlobal* result = 8117 HInstanceOfKnownGlobal* result =
8118 new(zone()) HInstanceOfKnownGlobal(context, left, target); 8118 new(zone()) HInstanceOfKnownGlobal(context, left, target);
8119 result->set_position(expr->position()); 8119 result->set_position(expr->position());
8120 return ast_context()->ReturnInstruction(result, expr->id()); 8120 return ast_context()->ReturnInstruction(result, expr->id());
8121 } 8121 }
8122 8122
8123 // Code below assumes that we don't fall through. 8123 // Code below assumes that we don't fall through.
8124 UNREACHABLE(); 8124 UNREACHABLE();
8125 } else if (op == Token::IN) { 8125 } else if (op == Token::IN) {
8126 HValue* function = AddLoadJSBuiltin(Builtins::IN); 8126 HValue* function = AddLoadJSBuiltin(Builtins::IN);
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
9849 if (ShouldProduceTraceOutput()) { 9849 if (ShouldProduceTraceOutput()) {
9850 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9850 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9851 } 9851 }
9852 9852
9853 #ifdef DEBUG 9853 #ifdef DEBUG
9854 graph_->Verify(false); // No full verify. 9854 graph_->Verify(false); // No full verify.
9855 #endif 9855 #endif
9856 } 9856 }
9857 9857
9858 } } // namespace v8::internal 9858 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/hydrogen-escape-analysis.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698