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

Side by Side Diff: src/deoptimizer.cc

Issue 148153010: Synchronize with r15701. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/debug.cc ('k') | src/flag-definitions.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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 #ifdef ENABLE_DEBUGGER_SUPPORT 180 #ifdef ENABLE_DEBUGGER_SUPPORT
181 DeoptimizedFrameInfo* Deoptimizer::DebuggerInspectableFrame( 181 DeoptimizedFrameInfo* Deoptimizer::DebuggerInspectableFrame(
182 JavaScriptFrame* frame, 182 JavaScriptFrame* frame,
183 int jsframe_index, 183 int jsframe_index,
184 Isolate* isolate) { 184 Isolate* isolate) {
185 ASSERT(frame->is_optimized()); 185 ASSERT(frame->is_optimized());
186 ASSERT(isolate->deoptimizer_data()->deoptimized_frame_info_ == NULL); 186 ASSERT(isolate->deoptimizer_data()->deoptimized_frame_info_ == NULL);
187 187
188 // Get the function and code from the frame. 188 // Get the function and code from the frame.
189 JSFunction* function = JSFunction::cast(frame->function()); 189 JSFunction* function = frame->function();
190 Code* code = frame->LookupCode(); 190 Code* code = frame->LookupCode();
191 191
192 // Locate the deoptimization point in the code. As we are at a call the 192 // Locate the deoptimization point in the code. As we are at a call the
193 // return address must be at a place in the code with deoptimization support. 193 // return address must be at a place in the code with deoptimization support.
194 SafepointEntry safepoint_entry = code->GetSafepointEntry(frame->pc()); 194 SafepointEntry safepoint_entry = code->GetSafepointEntry(frame->pc());
195 int deoptimization_index = safepoint_entry.deoptimization_index(); 195 int deoptimization_index = safepoint_entry.deoptimization_index();
196 ASSERT(deoptimization_index != Safepoint::kNoDeoptimizationIndex); 196 ASSERT(deoptimization_index != Safepoint::kNoDeoptimizationIndex);
197 197
198 // Always use the actual stack slots when calculating the fp to sp 198 // Always use the actual stack slots when calculating the fp to sp
199 // delta adding two for the function and context. 199 // delta adding two for the function and context.
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 deferred_objects_tagged_values_(0), 535 deferred_objects_tagged_values_(0),
536 deferred_objects_double_values_(0), 536 deferred_objects_double_values_(0),
537 deferred_objects_(0), 537 deferred_objects_(0),
538 deferred_heap_numbers_(0), 538 deferred_heap_numbers_(0),
539 trace_(false) { 539 trace_(false) {
540 // For COMPILED_STUBs called from builtins, the function pointer is a SMI 540 // For COMPILED_STUBs called from builtins, the function pointer is a SMI
541 // indicating an internal frame. 541 // indicating an internal frame.
542 if (function->IsSmi()) { 542 if (function->IsSmi()) {
543 function = NULL; 543 function = NULL;
544 } 544 }
545 ASSERT(from != NULL);
545 if (function != NULL && function->IsOptimized()) { 546 if (function != NULL && function->IsOptimized()) {
546 function->shared()->increment_deopt_count(); 547 function->shared()->increment_deopt_count();
547 if (bailout_type_ == Deoptimizer::SOFT) { 548 if (bailout_type_ == Deoptimizer::SOFT) {
548 isolate->counters()->soft_deopts_executed()->Increment(); 549 isolate->counters()->soft_deopts_executed()->Increment();
549 // Soft deopts shouldn't count against the overall re-optimization count 550 // Soft deopts shouldn't count against the overall re-optimization count
550 // that can eventually lead to disabling optimization for a function. 551 // that can eventually lead to disabling optimization for a function.
551 int opt_count = function->shared()->opt_count(); 552 int opt_count = function->shared()->opt_count();
552 if (opt_count > 0) opt_count--; 553 if (opt_count > 0) opt_count--;
553 function->shared()->set_opt_count(opt_count); 554 function->shared()->set_opt_count(opt_count);
554 } 555 }
(...skipping 11 matching lines...) Expand all
566 input_ = new(size) FrameDescription(size, function); 567 input_ = new(size) FrameDescription(size, function);
567 input_->SetFrameType(frame_type); 568 input_->SetFrameType(frame_type);
568 } 569 }
569 570
570 571
571 Code* Deoptimizer::FindOptimizedCode(JSFunction* function, 572 Code* Deoptimizer::FindOptimizedCode(JSFunction* function,
572 Code* optimized_code) { 573 Code* optimized_code) {
573 switch (bailout_type_) { 574 switch (bailout_type_) {
574 case Deoptimizer::SOFT: 575 case Deoptimizer::SOFT:
575 case Deoptimizer::EAGER: 576 case Deoptimizer::EAGER:
576 ASSERT(from_ == NULL);
577 return function->code();
578 case Deoptimizer::LAZY: { 577 case Deoptimizer::LAZY: {
579 Code* compiled_code = 578 Code* compiled_code =
580 isolate_->deoptimizer_data()->FindDeoptimizingCode(from_); 579 isolate_->deoptimizer_data()->FindDeoptimizingCode(from_);
581 return (compiled_code == NULL) 580 return (compiled_code == NULL)
582 ? static_cast<Code*>(isolate_->heap()->FindCodeObject(from_)) 581 ? static_cast<Code*>(isolate_->heap()->FindCodeObject(from_))
583 : compiled_code; 582 : compiled_code;
584 } 583 }
585 case Deoptimizer::OSR: { 584 case Deoptimizer::OSR: {
586 // The function has already been optimized and we're transitioning 585 // The function has already been optimized and we're transitioning
587 // from the unoptimized shared version to the optimized one in the 586 // from the unoptimized shared version to the optimized one in the
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 PrintF("Materializing a new heap number %p [%e] for arguments object\n", 1601 PrintF("Materializing a new heap number %p [%e] for arguments object\n",
1603 reinterpret_cast<void*>(*num), double_value); 1602 reinterpret_cast<void*>(*num), double_value);
1604 } 1603 }
1605 values.Set(i, num); 1604 values.Set(i, num);
1606 } 1605 }
1607 1606
1608 // Materialize arguments objects one frame at a time. 1607 // Materialize arguments objects one frame at a time.
1609 for (int frame_index = 0; frame_index < jsframe_count(); ++frame_index) { 1608 for (int frame_index = 0; frame_index < jsframe_count(); ++frame_index) {
1610 if (frame_index != 0) it->Advance(); 1609 if (frame_index != 0) it->Advance();
1611 JavaScriptFrame* frame = it->frame(); 1610 JavaScriptFrame* frame = it->frame();
1612 Handle<JSFunction> function(JSFunction::cast(frame->function()), isolate_); 1611 Handle<JSFunction> function(frame->function(), isolate_);
1613 Handle<JSObject> arguments; 1612 Handle<JSObject> arguments;
1614 for (int i = frame->ComputeExpressionsCount() - 1; i >= 0; --i) { 1613 for (int i = frame->ComputeExpressionsCount() - 1; i >= 0; --i) {
1615 if (frame->GetExpression(i) == isolate_->heap()->arguments_marker()) { 1614 if (frame->GetExpression(i) == isolate_->heap()->arguments_marker()) {
1616 ObjectMaterializationDescriptor descriptor = 1615 ObjectMaterializationDescriptor descriptor =
1617 deferred_objects_.RemoveLast(); 1616 deferred_objects_.RemoveLast();
1618 const int length = descriptor.object_length(); 1617 const int length = descriptor.object_length();
1619 if (arguments.is_null()) { 1618 if (arguments.is_null()) {
1620 if (frame->has_adapted_arguments()) { 1619 if (frame->has_adapted_arguments()) {
1621 // Use the arguments adapter frame we just built to materialize the 1620 // Use the arguments adapter frame we just built to materialize the
1622 // arguments object. FunctionGetArguments can't throw an exception, 1621 // arguments object. FunctionGetArguments can't throw an exception,
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 3095
3097 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3096 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3098 v->VisitPointer(BitCast<Object**>(&function_)); 3097 v->VisitPointer(BitCast<Object**>(&function_));
3099 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3098 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3100 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3099 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3101 } 3100 }
3102 3101
3103 #endif // ENABLE_DEBUGGER_SUPPORT 3102 #endif // ENABLE_DEBUGGER_SUPPORT
3104 3103
3105 } } // namespace v8::internal 3104 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698