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

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: Using HConstant, HLoadKeyed, HAdd and HStoreKeyed. 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 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 isolate()->counters()->soft_deopts_requested()->Increment(); 1014 isolate()->counters()->soft_deopts_requested()->Increment();
1015 if (FLAG_always_opt && mode == CAN_OMIT_SOFT_DEOPT) return; 1015 if (FLAG_always_opt && mode == CAN_OMIT_SOFT_DEOPT) return;
1016 if (current_block()->IsDeoptimizing()) return; 1016 if (current_block()->IsDeoptimizing()) return;
1017 Add<HSoftDeoptimize>(); 1017 Add<HSoftDeoptimize>();
1018 isolate()->counters()->soft_deopts_inserted()->Increment(); 1018 isolate()->counters()->soft_deopts_inserted()->Increment();
1019 current_block()->MarkAsDeoptimizing(); 1019 current_block()->MarkAsDeoptimizing();
1020 graph()->set_has_soft_deoptimize(true); 1020 graph()->set_has_soft_deoptimize(true);
1021 } 1021 }
1022 1022
1023 1023
1024 void HGraphBuilder::AddIncrementCounter(StatsCounter* counter,
1025 HValue* context) {
1026 if (FLAG_native_code_counters && counter->Enabled()) {
1027 HConstant* one = graph()->GetConstant1();
1028 HConstant* zero = graph()->GetConstant0();
1029 HValue* reference = Add<HConstant>(ExternalReference(counter));
1030 HValue* old_value = AddExternalArrayElementAccess(
1031 reference, zero, NULL, NULL, EXTERNAL_INT_ELEMENTS, false);
1032 HValue* new_value = AddInstruction(
1033 HAdd::New(zone(), context, old_value, one));
1034 AddExternalArrayElementAccess(
1035 reference, zero, new_value, NULL, EXTERNAL_INT_ELEMENTS, true);
1036 }
1037 }
1038
1039
1024 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) { 1040 HBasicBlock* HGraphBuilder::CreateBasicBlock(HEnvironment* env) {
1025 HBasicBlock* b = graph()->CreateBasicBlock(); 1041 HBasicBlock* b = graph()->CreateBasicBlock();
1026 b->SetInitialEnvironment(env); 1042 b->SetInitialEnvironment(env);
1027 return b; 1043 return b;
1028 } 1044 }
1029 1045
1030 1046
1031 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() { 1047 HBasicBlock* HGraphBuilder::CreateLoopHeaderBlock() {
1032 HBasicBlock* header = graph()->CreateBasicBlock(); 1048 HBasicBlock* header = graph()->CreateBasicBlock();
1033 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header); 1049 HEnvironment* entry_env = environment()->CopyAsLoopHeader(header);
(...skipping 8870 matching lines...) Expand 10 before | Expand all | Expand 10 after
9904 if (ShouldProduceTraceOutput()) { 9920 if (ShouldProduceTraceOutput()) {
9905 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 9921 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
9906 } 9922 }
9907 9923
9908 #ifdef DEBUG 9924 #ifdef DEBUG
9909 graph_->Verify(false); // No full verify. 9925 graph_->Verify(false); // No full verify.
9910 #endif 9926 #endif
9911 } 9927 }
9912 9928
9913 } } // namespace v8::internal 9929 } } // 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