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

Side by Side Diff: src/runtime.cc

Issue 256653004: Always include debugger support. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Makefile Created 6 years, 8 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/runtime.h ('k') | src/serialize.cc » ('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 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 5607 matching lines...) Expand 10 before | Expand all | Expand 10 after
5618 FixedArray* object_array = FixedArray::cast(object->elements()); 5618 FixedArray* object_array = FixedArray::cast(object->elements());
5619 object_array->set(store_index, *value); 5619 object_array->set(store_index, *value);
5620 } 5620 }
5621 return *object; 5621 return *object;
5622 } 5622 }
5623 5623
5624 5624
5625 // Check whether debugger and is about to step into the callback that is passed 5625 // Check whether debugger and is about to step into the callback that is passed
5626 // to a built-in function such as Array.forEach. 5626 // to a built-in function such as Array.forEach.
5627 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) { 5627 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) {
5628 #ifdef ENABLE_DEBUGGER_SUPPORT
5629 ASSERT(args.length() == 1); 5628 ASSERT(args.length() == 1);
5630 if (!isolate->IsDebuggerActive() || !isolate->debug()->StepInActive()) { 5629 if (!isolate->IsDebuggerActive() || !isolate->debug()->StepInActive()) {
5631 return isolate->heap()->false_value(); 5630 return isolate->heap()->false_value();
5632 } 5631 }
5633 CONVERT_ARG_CHECKED(Object, callback, 0); 5632 CONVERT_ARG_CHECKED(Object, callback, 0);
5634 // We do not step into the callback if it's a builtin or not even a function. 5633 // We do not step into the callback if it's a builtin or not even a function.
5635 return isolate->heap()->ToBoolean( 5634 return isolate->heap()->ToBoolean(
5636 callback->IsJSFunction() && !JSFunction::cast(callback)->IsBuiltin()); 5635 callback->IsJSFunction() && !JSFunction::cast(callback)->IsBuiltin());
5637 #else
5638 return isolate->heap()->false_value();
5639 #endif // ENABLE_DEBUGGER_SUPPORT
5640 } 5636 }
5641 5637
5642 5638
5643 // Set one shot breakpoints for the callback function that is passed to a 5639 // Set one shot breakpoints for the callback function that is passed to a
5644 // built-in function such as Array.forEach to enable stepping into the callback. 5640 // built-in function such as Array.forEach to enable stepping into the callback.
5645 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { 5641 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) {
5646 #ifdef ENABLE_DEBUGGER_SUPPORT
5647 ASSERT(args.length() == 1); 5642 ASSERT(args.length() == 1);
5648 Debug* debug = isolate->debug(); 5643 Debug* debug = isolate->debug();
5649 if (!debug->IsStepping()) return isolate->heap()->undefined_value(); 5644 if (!debug->IsStepping()) return isolate->heap()->undefined_value();
5650 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0); 5645 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0);
5651 HandleScope scope(isolate); 5646 HandleScope scope(isolate);
5652 // When leaving the callback, step out has been activated, but not performed 5647 // When leaving the callback, step out has been activated, but not performed
5653 // if we do not leave the builtin. To be able to step into the callback 5648 // if we do not leave the builtin. To be able to step into the callback
5654 // again, we need to clear the step out at this point. 5649 // again, we need to clear the step out at this point.
5655 debug->ClearStepOut(); 5650 debug->ClearStepOut();
5656 debug->FloodWithOneShot(callback); 5651 debug->FloodWithOneShot(callback);
5657 #endif // ENABLE_DEBUGGER_SUPPORT
5658 return isolate->heap()->undefined_value(); 5652 return isolate->heap()->undefined_value();
5659 } 5653 }
5660 5654
5661 5655
5662 // Notify the debugger if an expcetion in a promise is not caught (yet). 5656 // Notify the debugger if an expcetion in a promise is not caught (yet).
5663 RUNTIME_FUNCTION(Runtime_DebugPendingExceptionInPromise) { 5657 RUNTIME_FUNCTION(Runtime_DebugPendingExceptionInPromise) {
5664 #ifdef ENABLE_DEBUGGER_SUPPORT
5665 ASSERT(args.length() == 2); 5658 ASSERT(args.length() == 2);
5666 HandleScope scope(isolate); 5659 HandleScope scope(isolate);
5667 CONVERT_ARG_HANDLE_CHECKED(Object, exception, 0); 5660 CONVERT_ARG_HANDLE_CHECKED(Object, exception, 0);
5668 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 1); 5661 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 1);
5669 isolate->debugger()->OnException(exception, true, promise); 5662 isolate->debugger()->OnException(exception, true, promise);
5670 #endif // ENABLE_DEBUGGER_SUPPORT
5671 return isolate->heap()->undefined_value(); 5663 return isolate->heap()->undefined_value();
5672 } 5664 }
5673 5665
5674 5666
5675 // Set a local property, even if it is READ_ONLY. If the property does not 5667 // Set a local property, even if it is READ_ONLY. If the property does not
5676 // exist, it will be added with attributes NONE. 5668 // exist, it will be added with attributes NONE.
5677 RUNTIME_FUNCTION(Runtime_IgnoreAttributesAndSetProperty) { 5669 RUNTIME_FUNCTION(Runtime_IgnoreAttributesAndSetProperty) {
5678 HandleScope scope(isolate); 5670 HandleScope scope(isolate);
5679 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); 5671 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
5680 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); 5672 CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
(...skipping 2668 matching lines...) Expand 10 before | Expand all | Expand 10 after
8349 8341
8350 // If function should not have prototype, construction is not allowed. In this 8342 // If function should not have prototype, construction is not allowed. In this
8351 // case generated code bailouts here, since function has no initial_map. 8343 // case generated code bailouts here, since function has no initial_map.
8352 if (!function->should_have_prototype() && !function->shared()->bound()) { 8344 if (!function->should_have_prototype() && !function->shared()->bound()) {
8353 Vector< Handle<Object> > arguments = HandleVector(&constructor, 1); 8345 Vector< Handle<Object> > arguments = HandleVector(&constructor, 1);
8354 Handle<Object> type_error = 8346 Handle<Object> type_error =
8355 isolate->factory()->NewTypeError("not_constructor", arguments); 8347 isolate->factory()->NewTypeError("not_constructor", arguments);
8356 return isolate->Throw(*type_error); 8348 return isolate->Throw(*type_error);
8357 } 8349 }
8358 8350
8359 #ifdef ENABLE_DEBUGGER_SUPPORT
8360 Debug* debug = isolate->debug(); 8351 Debug* debug = isolate->debug();
8361 // Handle stepping into constructors if step into is active. 8352 // Handle stepping into constructors if step into is active.
8362 if (debug->StepInActive()) { 8353 if (debug->StepInActive()) {
8363 debug->HandleStepIn(function, Handle<Object>::null(), 0, true); 8354 debug->HandleStepIn(function, Handle<Object>::null(), 0, true);
8364 } 8355 }
8365 #endif
8366 8356
8367 if (function->has_initial_map()) { 8357 if (function->has_initial_map()) {
8368 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) { 8358 if (function->initial_map()->instance_type() == JS_FUNCTION_TYPE) {
8369 // The 'Function' function ignores the receiver object when 8359 // The 'Function' function ignores the receiver object when
8370 // called using 'new' and creates a new JSFunction object that 8360 // called using 'new' and creates a new JSFunction object that
8371 // is returned. The receiver object is only used for error 8361 // is returned. The receiver object is only used for error
8372 // reporting if an error occurs when constructing the new 8362 // reporting if an error occurs when constructing the new
8373 // JSFunction. Factory::NewJSObject() should not be used to 8363 // JSFunction. Factory::NewJSObject() should not be used to
8374 // allocate JSFunctions since it does not properly initialize 8364 // allocate JSFunctions since it does not properly initialize
8375 // the shared part of the function. Since the receiver is 8365 // the shared part of the function. Since the receiver is
(...skipping 2372 matching lines...) Expand 10 before | Expand all | Expand 10 after
10748 AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER; 10738 AccessorComponent component = flag == 0 ? ACCESSOR_GETTER : ACCESSOR_SETTER;
10749 if (!receiver->IsJSObject()) return isolate->heap()->undefined_value(); 10739 if (!receiver->IsJSObject()) return isolate->heap()->undefined_value();
10750 Handle<Object> result; 10740 Handle<Object> result;
10751 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 10741 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
10752 isolate, result, 10742 isolate, result,
10753 JSObject::GetAccessor(Handle<JSObject>::cast(receiver), name, component)); 10743 JSObject::GetAccessor(Handle<JSObject>::cast(receiver), name, component));
10754 return *result; 10744 return *result;
10755 } 10745 }
10756 10746
10757 10747
10758 #ifdef ENABLE_DEBUGGER_SUPPORT
10759 RUNTIME_FUNCTION(Runtime_DebugBreak) { 10748 RUNTIME_FUNCTION(Runtime_DebugBreak) {
10760 SealHandleScope shs(isolate); 10749 SealHandleScope shs(isolate);
10761 ASSERT(args.length() == 0); 10750 ASSERT(args.length() == 0);
10762 return Execution::DebugBreakHelper(isolate); 10751 return Execution::DebugBreakHelper(isolate);
10763 } 10752 }
10764 10753
10765 10754
10766 // Helper functions for wrapping and unwrapping stack frame ids. 10755 // Helper functions for wrapping and unwrapping stack frame ids.
10767 static Smi* WrapFrameId(StackFrame::Id id) { 10756 static Smi* WrapFrameId(StackFrame::Id id) {
10768 ASSERT(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4))); 10757 ASSERT(IsAligned(OffsetFrom(id), static_cast<intptr_t>(4)));
(...skipping 2917 matching lines...) Expand 10 before | Expand all | Expand 10 after
13686 RUNTIME_FUNCTION(Runtime_GetHeapUsage) { 13675 RUNTIME_FUNCTION(Runtime_GetHeapUsage) {
13687 SealHandleScope shs(isolate); 13676 SealHandleScope shs(isolate);
13688 ASSERT(args.length() == 0); 13677 ASSERT(args.length() == 0);
13689 int usage = static_cast<int>(isolate->heap()->SizeOfObjects()); 13678 int usage = static_cast<int>(isolate->heap()->SizeOfObjects());
13690 if (!Smi::IsValid(usage)) { 13679 if (!Smi::IsValid(usage)) {
13691 return *isolate->factory()->NewNumberFromInt(usage); 13680 return *isolate->factory()->NewNumberFromInt(usage);
13692 } 13681 }
13693 return Smi::FromInt(usage); 13682 return Smi::FromInt(usage);
13694 } 13683 }
13695 13684
13696 #endif // ENABLE_DEBUGGER_SUPPORT
13697
13698 13685
13699 #ifdef V8_I18N_SUPPORT 13686 #ifdef V8_I18N_SUPPORT
13700 RUNTIME_FUNCTION(Runtime_CanonicalizeLanguageTag) { 13687 RUNTIME_FUNCTION(Runtime_CanonicalizeLanguageTag) {
13701 HandleScope scope(isolate); 13688 HandleScope scope(isolate);
13702 Factory* factory = isolate->factory(); 13689 Factory* factory = isolate->factory();
13703 13690
13704 ASSERT(args.length() == 1); 13691 ASSERT(args.length() == 1);
13705 CONVERT_ARG_HANDLE_CHECKED(String, locale_id_str, 0); 13692 CONVERT_ARG_HANDLE_CHECKED(String, locale_id_str, 0);
13706 13693
13707 v8::String::Utf8Value locale_id(v8::Utils::ToLocal(locale_id_str)); 13694 v8::String::Utf8Value locale_id(v8::Utils::ToLocal(locale_id_str));
(...skipping 1449 matching lines...) Expand 10 before | Expand all | Expand 10 after
15157 } 15144 }
15158 return NULL; 15145 return NULL;
15159 } 15146 }
15160 15147
15161 15148
15162 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15149 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15163 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15150 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15164 } 15151 }
15165 15152
15166 } } // namespace v8::internal 15153 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/serialize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698