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

Side by Side Diff: src/compiler.cc

Issue 26955004: Refactor part of handles.cc (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 | « no previous file | src/handles.h » ('j') | src/runtime.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 #endif 548 #endif
549 549
550 550
551 static bool DebuggerWantsEagerCompilation(CompilationInfo* info, 551 static bool DebuggerWantsEagerCompilation(CompilationInfo* info,
552 bool allow_lazy_without_ctx = false) { 552 bool allow_lazy_without_ctx = false) {
553 return LiveEditFunctionTracker::IsActive(info->isolate()) || 553 return LiveEditFunctionTracker::IsActive(info->isolate()) ||
554 (info->isolate()->DebuggerHasBreakPoints() && !allow_lazy_without_ctx); 554 (info->isolate()->DebuggerHasBreakPoints() && !allow_lazy_without_ctx);
555 } 555 }
556 556
557 557
558 // Sets the expected number of properties based on estimate from compiler.
559 void SetExpectedNofPropertiesFromEstimate(Handle<SharedFunctionInfo> shared,
560 int estimate) {
561 // See the comment in SetExpectedNofProperties.
562 if (shared->live_objects_may_exist()) return;
563
564 // If no properties are added in the constructor, they are more likely
565 // to be added later.
566 if (estimate == 0) estimate = 2;
567
568 // TODO(yangguo): check whether those heuristics are still up-to-date.
569 // We do not shrink objects that go into a snapshot (yet), so we adjust
570 // the estimate conservatively.
571 if (Serializer::enabled()) {
572 estimate += 2;
573 } else if (FLAG_clever_optimizations) {
574 // Inobject slack tracking will reclaim redundant inobject space later,
575 // so we can afford to adjust the estimate generously.
576 estimate += 8;
577 } else {
578 estimate += 3;
579 }
580
581 shared->set_expected_nof_properties(estimate);
582 }
583
584
558 static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) { 585 static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) {
559 Isolate* isolate = info->isolate(); 586 Isolate* isolate = info->isolate();
560 PostponeInterruptsScope postpone(isolate); 587 PostponeInterruptsScope postpone(isolate);
561 588
562 ASSERT(!isolate->native_context().is_null()); 589 ASSERT(!isolate->native_context().is_null());
563 Handle<Script> script = info->script(); 590 Handle<Script> script = info->script();
564 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile? 591 // TODO(svenpanne) Obscure place for this, perhaps move to OnBeforeCompile?
565 FixedArray* array = isolate->native_context()->embedder_data(); 592 FixedArray* array = isolate->native_context()->embedder_data();
566 script->set_context_data(array->get(0)); 593 script->set_context_data(array->get(0));
567 594
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 AllowHandleDereference allow_deref; 1307 AllowHandleDereference allow_deref;
1281 bool tracing_on = info()->IsStub() 1308 bool tracing_on = info()->IsStub()
1282 ? FLAG_trace_hydrogen_stubs 1309 ? FLAG_trace_hydrogen_stubs
1283 : (FLAG_trace_hydrogen && 1310 : (FLAG_trace_hydrogen &&
1284 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); 1311 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter));
1285 return (tracing_on && 1312 return (tracing_on &&
1286 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); 1313 OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL);
1287 } 1314 }
1288 1315
1289 } } // namespace v8::internal 1316 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/handles.h » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698