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

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: Add ExternalMemory portion 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
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 AddStore(reference, HObjectAccess::ForCounter(), new_value);
997 }
998 }
999
1000
989 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { 1001 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) {
990 HBasicBlock* b = graph()->CreateBasicBlock(); 1002 HBasicBlock* b = graph()->CreateBasicBlock();
991 b->SetInitialEnvironment(env); 1003 b->SetInitialEnvironment(env);
992 return b; 1004 return b;
993 } 1005 }
994 1006
995 1007
996 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { 1008 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() {
997 HBasicBlock* header = graph()->CreateBasicBlock(); 1009 HBasicBlock* header = graph()->CreateBasicBlock();
998 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header); 1010 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header);
(...skipping 8913 matching lines...) Expand 10 before | Expand all | Expand 10 after
9912 if (ShouldProduceTraceOutput()) { 9924 if (ShouldProduceTraceOutput()) {
9913 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9925 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9914 } 9926 }
9915 9927
9916 #ifdef DEBUG 9928 #ifdef DEBUG
9917 graph_->Verify(false); // No full verify. 9929 graph_->Verify(false); // No full verify.
9918 #endif 9930 #endif
9919 } 9931 }
9920 9932
9921 } } // namespace v8::internal 9933 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/hydrogen-instructions.h » ('j') | src/hydrogen-instructions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698