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

Side by Side Diff: src/hydrogen.cc

Issue 19562003: Add support for IncrementCounter in Hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: And another try Created 7 years, 4 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/hydrogen.h ('k') | 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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) { 979 HInstruction* HGraphBuilder::AddInstruction(HInstruction* instr) {
980 ASSERT(current_block() != NULL); 980 ASSERT(current_block() != NULL);
981 current_block()->AddInstruction(instr); 981 current_block()->AddInstruction(instr);
982 if (no_side_effects_scope_count_ > 0) { 982 if (no_side_effects_scope_count_ > 0) {
983 instr->SetFlag(HValue::kHasNoObservableSideEffects); 983 instr->SetFlag(HValue::kHasNoObservableSideEffects);
984 } 984 }
985 return instr; 985 return instr;
986 } 986 }
987 987
988 988
989 void HGraphBuilder::AddIncrementCounter(StatsCounter* counter,
990 HValue* context) {
991 if (FLAG_native_code_counters && counter->Enabled()) {
992 HValue* reference = Add<HConstant>(ExternalReference(counter));
993 HValue* old_value = AddLoad(reference, HObjectAccess::ForCounter(), NULL);
994 HValue* new_value = AddInstruction(
995 HAdd::New(zone(), context, old_value, graph()->GetConstant1()));
996 new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow
997 AddStore(reference, HObjectAccess::ForCounter(), new_value);
998 }
999 }
1000
1001
989 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { 1002 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) {
990 HBasicBlock* b = graph()->CreateBasicBlock(); 1003 HBasicBlock* b = graph()->CreateBasicBlock();
991 b->SetInitialEnvironment(env); 1004 b->SetInitialEnvironment(env);
992 return b; 1005 return b;
993 } 1006 }
994 1007
995 1008
996 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { 1009 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() {
997 HBasicBlock* header = graph()->CreateBasicBlock(); 1010 HBasicBlock* header = graph()->CreateBasicBlock();
998 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header); 1011 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header);
(...skipping 8929 matching lines...) Expand 10 before | Expand all | Expand 10 after
9928 if (ShouldProduceTraceOutput()) { 9941 if (ShouldProduceTraceOutput()) {
9929 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9942 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9930 } 9943 }
9931 9944
9932 #ifdef DEBUG 9945 #ifdef DEBUG
9933 graph_->Verify(false); // No full verify. 9946 graph_->Verify(false); // No full verify.
9934 #endif 9947 #endif
9935 } 9948 }
9936 9949
9937 } } // namespace v8::internal 9950 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698