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

Side by Side Diff: src/hydrogen.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 9936 matching lines...) Expand 10 before | Expand all | Expand 10 after
9947 HInstruction* HOptimizedGraphBuilder::BuildStringCharCodeAt( 9947 HInstruction* HOptimizedGraphBuilder::BuildStringCharCodeAt(
9948 HValue* string, 9948 HValue* string,
9949 HValue* index) { 9949 HValue* index) {
9950 if (string->IsConstant() && index->IsConstant()) { 9950 if (string->IsConstant() && index->IsConstant()) {
9951 HConstant* c_string = HConstant::cast(string); 9951 HConstant* c_string = HConstant::cast(string);
9952 HConstant* c_index = HConstant::cast(index); 9952 HConstant* c_index = HConstant::cast(index);
9953 if (c_string->HasStringValue() && c_index->HasNumberValue()) { 9953 if (c_string->HasStringValue() && c_index->HasNumberValue()) {
9954 int32_t i = c_index->NumberValueAsInteger32(); 9954 int32_t i = c_index->NumberValueAsInteger32();
9955 Handle<String> s = c_string->StringValue(); 9955 Handle<String> s = c_string->StringValue();
9956 if (i < 0 || i >= s->length()) { 9956 if (i < 0 || i >= s->length()) {
9957 return New<HConstant>(OS::nan_value()); 9957 return New<HConstant>(base::OS::nan_value());
9958 } 9958 }
9959 return New<HConstant>(s->Get(i)); 9959 return New<HConstant>(s->Get(i));
9960 } 9960 }
9961 } 9961 }
9962 string = BuildCheckString(string); 9962 string = BuildCheckString(string);
9963 index = Add<HBoundsCheck>(index, AddLoadStringLength(string)); 9963 index = Add<HBoundsCheck>(index, AddLoadStringLength(string));
9964 return New<HStringCharCodeAt>(string, index); 9964 return New<HStringCharCodeAt>(string, index);
9965 } 9965 }
9966 9966
9967 9967
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after
12049 PrintStringProperty("name", name->ToCString().get()); 12049 PrintStringProperty("name", name->ToCString().get());
12050 PrintIndent(); 12050 PrintIndent();
12051 trace_.Add("method \"%s:%d\"\n", 12051 trace_.Add("method \"%s:%d\"\n",
12052 name->ToCString().get(), 12052 name->ToCString().get(),
12053 info->optimization_id()); 12053 info->optimization_id());
12054 } else { 12054 } else {
12055 CodeStub::Major major_key = info->code_stub()->MajorKey(); 12055 CodeStub::Major major_key = info->code_stub()->MajorKey();
12056 PrintStringProperty("name", CodeStub::MajorName(major_key, false)); 12056 PrintStringProperty("name", CodeStub::MajorName(major_key, false));
12057 PrintStringProperty("method", "stub"); 12057 PrintStringProperty("method", "stub");
12058 } 12058 }
12059 PrintLongProperty("date", static_cast<int64_t>(OS::TimeCurrentMillis())); 12059 PrintLongProperty("date",
12060 static_cast<int64_t>(base::OS::TimeCurrentMillis()));
12060 } 12061 }
12061 12062
12062 12063
12063 void HTracer::TraceLithium(const char* name, LChunk* chunk) { 12064 void HTracer::TraceLithium(const char* name, LChunk* chunk) {
12064 ASSERT(!chunk->isolate()->concurrent_recompilation_enabled()); 12065 ASSERT(!chunk->isolate()->concurrent_recompilation_enabled());
12065 AllowHandleDereference allow_deref; 12066 AllowHandleDereference allow_deref;
12066 AllowDeferredHandleDereference allow_deferred_deref; 12067 AllowDeferredHandleDereference allow_deferred_deref;
12067 Trace(name, chunk->graph(), chunk); 12068 Trace(name, chunk->graph(), chunk);
12068 } 12069 }
12069 12070
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
12296 12297
12297 12298
12298 void HStatistics::Initialize(CompilationInfo* info) { 12299 void HStatistics::Initialize(CompilationInfo* info) {
12299 if (info->shared_info().is_null()) return; 12300 if (info->shared_info().is_null()) return;
12300 source_size_ += info->shared_info()->SourceSize(); 12301 source_size_ += info->shared_info()->SourceSize();
12301 } 12302 }
12302 12303
12303 12304
12304 void HStatistics::Print() { 12305 void HStatistics::Print() {
12305 PrintF("Timing results:\n"); 12306 PrintF("Timing results:\n");
12306 TimeDelta sum; 12307 base::TimeDelta sum;
12307 for (int i = 0; i < times_.length(); ++i) { 12308 for (int i = 0; i < times_.length(); ++i) {
12308 sum += times_[i]; 12309 sum += times_[i];
12309 } 12310 }
12310 12311
12311 for (int i = 0; i < names_.length(); ++i) { 12312 for (int i = 0; i < names_.length(); ++i) {
12312 PrintF("%32s", names_[i]); 12313 PrintF("%32s", names_[i]);
12313 double ms = times_[i].InMillisecondsF(); 12314 double ms = times_[i].InMillisecondsF();
12314 double percent = times_[i].PercentOf(sum); 12315 double percent = times_[i].PercentOf(sum);
12315 PrintF(" %8.3f ms / %4.1f %% ", ms, percent); 12316 PrintF(" %8.3f ms / %4.1f %% ", ms, percent);
12316 12317
12317 unsigned size = sizes_[i]; 12318 unsigned size = sizes_[i];
12318 double size_percent = static_cast<double>(size) * 100 / total_size_; 12319 double size_percent = static_cast<double>(size) * 100 / total_size_;
12319 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent); 12320 PrintF(" %9u bytes / %4.1f %%\n", size, size_percent);
12320 } 12321 }
12321 12322
12322 PrintF("----------------------------------------" 12323 PrintF("----------------------------------------"
12323 "---------------------------------------\n"); 12324 "---------------------------------------\n");
12324 TimeDelta total = create_graph_ + optimize_graph_ + generate_code_; 12325 base::TimeDelta total = create_graph_ + optimize_graph_ + generate_code_;
12325 PrintF("%32s %8.3f ms / %4.1f %% \n", 12326 PrintF("%32s %8.3f ms / %4.1f %% \n",
12326 "Create graph", 12327 "Create graph",
12327 create_graph_.InMillisecondsF(), 12328 create_graph_.InMillisecondsF(),
12328 create_graph_.PercentOf(total)); 12329 create_graph_.PercentOf(total));
12329 PrintF("%32s %8.3f ms / %4.1f %% \n", 12330 PrintF("%32s %8.3f ms / %4.1f %% \n",
12330 "Optimize graph", 12331 "Optimize graph",
12331 optimize_graph_.InMillisecondsF(), 12332 optimize_graph_.InMillisecondsF(),
12332 optimize_graph_.PercentOf(total)); 12333 optimize_graph_.PercentOf(total));
12333 PrintF("%32s %8.3f ms / %4.1f %% \n", 12334 PrintF("%32s %8.3f ms / %4.1f %% \n",
12334 "Generate and install code", 12335 "Generate and install code",
(...skipping 12 matching lines...) Expand all
12347 : 0; 12348 : 0;
12348 double normalized_size_in_kb = source_size_in_kb > 0 12349 double normalized_size_in_kb = source_size_in_kb > 0
12349 ? total_size_ / 1024 / source_size_in_kb 12350 ? total_size_ / 1024 / source_size_in_kb
12350 : 0; 12351 : 0;
12351 PrintF("%32s %8.3f ms %7.3f kB allocated\n", 12352 PrintF("%32s %8.3f ms %7.3f kB allocated\n",
12352 "Average per kB source", 12353 "Average per kB source",
12353 normalized_time, normalized_size_in_kb); 12354 normalized_time, normalized_size_in_kb);
12354 } 12355 }
12355 12356
12356 12357
12357 void HStatistics::SaveTiming(const char* name, TimeDelta time, unsigned size) { 12358 void HStatistics::SaveTiming(const char* name, base::TimeDelta time,
12359 unsigned size) {
12358 total_size_ += size; 12360 total_size_ += size;
12359 for (int i = 0; i < names_.length(); ++i) { 12361 for (int i = 0; i < names_.length(); ++i) {
12360 if (strcmp(names_[i], name) == 0) { 12362 if (strcmp(names_[i], name) == 0) {
12361 times_[i] += time; 12363 times_[i] += time;
12362 sizes_[i] += size; 12364 sizes_[i] += size;
12363 return; 12365 return;
12364 } 12366 }
12365 } 12367 }
12366 names_.Add(name); 12368 names_.Add(name);
12367 times_.Add(time); 12369 times_.Add(time);
12368 sizes_.Add(size); 12370 sizes_.Add(size);
12369 } 12371 }
12370 12372
12371 12373
12372 HPhase::~HPhase() { 12374 HPhase::~HPhase() {
12373 if (ShouldProduceTraceOutput()) { 12375 if (ShouldProduceTraceOutput()) {
12374 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12376 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12375 } 12377 }
12376 12378
12377 #ifdef DEBUG 12379 #ifdef DEBUG
12378 graph_->Verify(false); // No full verify. 12380 graph_->Verify(false); // No full verify.
12379 #endif 12381 #endif
12380 } 12382 }
12381 12383
12382 } } // namespace v8::internal 12384 } } // namespace v8::internal
OLDNEW
« src/base/macros.h ('K') | « src/hydrogen.h ('k') | src/hydrogen-bce.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698