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

Side by Side Diff: src/hydrogen.cc

Issue 9463052: When compiling for-in pass correct context value to the increment instruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
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 3057 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 3068
3069 if (first_expression_index != length) { 3069 if (first_expression_index != length) {
3070 environment()->Drop(length - first_expression_index); 3070 environment()->Drop(length - first_expression_index);
3071 for (int i = first_expression_index; i < length; ++i) { 3071 for (int i = first_expression_index; i < length; ++i) {
3072 HUnknownOSRValue* osr_value = new(zone()) HUnknownOSRValue; 3072 HUnknownOSRValue* osr_value = new(zone()) HUnknownOSRValue;
3073 AddInstruction(osr_value); 3073 AddInstruction(osr_value);
3074 environment()->Push(osr_value); 3074 environment()->Push(osr_value);
3075 } 3075 }
3076 } 3076 }
3077 3077
3078
3079 AddSimulate(osr_entry_id); 3078 AddSimulate(osr_entry_id);
3080 AddInstruction(new(zone()) HOsrEntry(osr_entry_id)); 3079 AddInstruction(new(zone()) HOsrEntry(osr_entry_id));
3081 HContext* context = new(zone()) HContext; 3080 HContext* context = new(zone()) HContext;
3082 AddInstruction(context); 3081 AddInstruction(context);
3083 environment()->BindContext(context); 3082 environment()->BindContext(context);
3084 current_block()->Goto(loop_predecessor); 3083 current_block()->Goto(loop_predecessor);
3085 loop_predecessor->SetJoinId(statement->EntryId()); 3084 loop_predecessor->SetJoinId(statement->EntryId());
3086 set_current_block(loop_predecessor); 3085 set_current_block(loop_predecessor);
3087 } 3086 }
3088 3087
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3249 if (!stmt->each()->IsVariableProxy() || 3248 if (!stmt->each()->IsVariableProxy() ||
3250 !stmt->each()->AsVariableProxy()->var()->IsStackLocal()) { 3249 !stmt->each()->AsVariableProxy()->var()->IsStackLocal()) {
3251 return Bailout("ForInStatement with non-local each variable"); 3250 return Bailout("ForInStatement with non-local each variable");
3252 } 3251 }
3253 3252
3254 Variable* each_var = stmt->each()->AsVariableProxy()->var(); 3253 Variable* each_var = stmt->each()->AsVariableProxy()->var();
3255 3254
3256 CHECK_ALIVE(VisitForValue(stmt->enumerable())); 3255 CHECK_ALIVE(VisitForValue(stmt->enumerable()));
3257 HValue* enumerable = Top(); // Leave enumerable at the top. 3256 HValue* enumerable = Top(); // Leave enumerable at the top.
3258 3257
3259 HValue* context = environment()->LookupContext();
3260
3261 HInstruction* map = AddInstruction(new(zone()) HForInPrepareMap( 3258 HInstruction* map = AddInstruction(new(zone()) HForInPrepareMap(
3262 context, enumerable)); 3259 environment()->LookupContext(), enumerable));
3263 AddSimulate(stmt->PrepareId()); 3260 AddSimulate(stmt->PrepareId());
3264 3261
3265 HInstruction* array = AddInstruction( 3262 HInstruction* array = AddInstruction(
3266 new(zone()) HForInCacheArray( 3263 new(zone()) HForInCacheArray(
3267 enumerable, 3264 enumerable,
3268 map, 3265 map,
3269 DescriptorArray::kEnumCacheBridgeCacheIndex)); 3266 DescriptorArray::kEnumCacheBridgeCacheIndex));
3270 3267
3271 HInstruction* array_length = AddInstruction( 3268 HInstruction* array_length = AddInstruction(
3272 new(zone()) HFixedArrayBaseLength(array)); 3269 new(zone()) HFixedArrayBaseLength(array));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3329 BreakAndContinueInfo break_info(stmt, 5); 3326 BreakAndContinueInfo break_info(stmt, 5);
3330 CHECK_BAILOUT(VisitLoopBody(stmt, loop_entry, &break_info)); 3327 CHECK_BAILOUT(VisitLoopBody(stmt, loop_entry, &break_info));
3331 3328
3332 HBasicBlock* body_exit = 3329 HBasicBlock* body_exit =
3333 JoinContinue(stmt, current_block(), break_info.continue_block()); 3330 JoinContinue(stmt, current_block(), break_info.continue_block());
3334 3331
3335 if (body_exit != NULL) { 3332 if (body_exit != NULL) {
3336 set_current_block(body_exit); 3333 set_current_block(body_exit);
3337 3334
3338 HValue* current_index = Pop(); 3335 HValue* current_index = Pop();
3339 PushAndAdd( 3336 HInstruction* new_index = new(zone()) HAdd(environment()->LookupContext(),
3340 new(zone()) HAdd(context, current_index, graph()->GetConstant1())); 3337 current_index,
3341 3338 graph()->GetConstant1());
3339 new_index->AssumeRepresentation(Representation::Integer32());
3340 PushAndAdd(new_index);
3342 body_exit = current_block(); 3341 body_exit = current_block();
3343 } 3342 }
3344 3343
3345 HBasicBlock* loop_exit = CreateLoop(stmt, 3344 HBasicBlock* loop_exit = CreateLoop(stmt,
3346 loop_entry, 3345 loop_entry,
3347 body_exit, 3346 body_exit,
3348 loop_successor, 3347 loop_successor,
3349 break_info.break_block()); 3348 break_info.break_block());
3350 3349
3351 set_current_block(loop_exit); 3350 set_current_block(loop_exit);
(...skipping 4548 matching lines...) Expand 10 before | Expand all | Expand 10 after
7900 } 7899 }
7901 } 7900 }
7902 7901
7903 #ifdef DEBUG 7902 #ifdef DEBUG
7904 if (graph_ != NULL) graph_->Verify(false); // No full verify. 7903 if (graph_ != NULL) graph_->Verify(false); // No full verify.
7905 if (allocator_ != NULL) allocator_->Verify(); 7904 if (allocator_ != NULL) allocator_->Verify();
7906 #endif 7905 #endif
7907 } 7906 }
7908 7907
7909 } } // namespace v8::internal 7908 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698