Changed all text files to have native svn:eol-style.
Added a few samples and support for building them. The samples include a simple shell that can be used to benchmark and test V8.
Changed V8::GetVersion to return the version as a string.
Added source for lazily loaded scripts to snapshots and made serialization non-destructive.
Improved ARM support by fixing the write barrier code to use aligned loads and stores and by removing premature locals optimization that relied on broken support for callee-saved registers (removed).
Refactored the code for marking live objects during garbage collection and the code for allocating objects in paged spaces. Introduced an abstraction for the map word of a heap-allocated object and changed the memory allocator to allocate executable memory only for spaces that may contain code objects.
Moved StringBuilder to utils.h and ScopedLock to platform.h, where they can be used by debugging and logging modules. Added thread-safe message queues for dealing with debugger events.
Fixed the source code reported by toString for certain builtin empty functions and made sure that the prototype property of a function is enumerable.
Improved performance of converting values to condition flags in generated code.
Merged disassembler-{arch} files.
git-svn-id: http://v8.googlecode.com/svn/trunk@8 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/runtime.cc b/src/runtime.cc
index 2e3025b..b54ed6a 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -806,6 +806,10 @@
target->shared()->set_length(fun->shared()->length());
target->shared()->set_formal_parameter_count(
fun->shared()->formal_parameter_count());
+ // Set the source code of the target function.
+ target->shared()->set_script(fun->shared()->script());
+ target->shared()->set_start_position(fun->shared()->start_position());
+ target->shared()->set_end_position(fun->shared()->end_position());
context = Handle<Context>(fun->context());
// Make sure we get a fresh copy of the literal vector to avoid
@@ -2730,31 +2734,31 @@
static Object* Runtime_NewContext(Arguments args) {
NoHandleAllocation ha;
- ASSERT(args.length() == 2);
+ ASSERT(args.length() == 1);
- CONVERT_CHECKED(JSFunction, function, args[1]);
+ CONVERT_CHECKED(JSFunction, function, args[0]);
int length = ScopeInfo<>::NumberOfContextSlots(function->code());
Object* result = Heap::AllocateFunctionContext(length, function);
if (result->IsFailure()) return result;
Top::set_context(Context::cast(result));
- return args[0]; // return TOS
+ return result; // non-failure
}
static Object* Runtime_PushContext(Arguments args) {
NoHandleAllocation ha;
- ASSERT(args.length() == 2);
+ ASSERT(args.length() == 1);
// Convert the object to a proper JavaScript object.
- Object* object = args[1];
+ Object* object = args[0];
if (!object->IsJSObject()) {
object = object->ToObject();
if (object->IsFailure()) {
if (!Failure::cast(object)->IsInternalError()) return object;
HandleScope scope;
- Handle<Object> handle(args[1]);
+ Handle<Object> handle(args[0]);
Handle<Object> result =
Factory::NewTypeError("with_expression", HandleVector(&handle, 1));
return Top::Throw(*result);
@@ -2767,7 +2771,7 @@
Top::set_context(Context::cast(result));
- return args[0]; // return TOS
+ return result;
}
@@ -2993,9 +2997,9 @@
return args[0];
}
- // Don't break in system functions. If the current function is either in the
- // builtins object of some context or is in the debug context just return with
- // the debug break stack guard active.
+ // Don't break in system functions. If the current function is
+ // either in the builtins object of some context or is in the debug
+ // context just return with the debug break stack guard active.
JavaScriptFrameIterator it;
JavaScriptFrame* frame = it.frame();
Object* fun = frame->function();
@@ -3013,13 +3017,8 @@
SaveBreakFrame save;
EnterDebuggerContext enter;
- // Process debug requests. Returns true if break request.
- bool break_request = Debugger::ProcessPendingRequests();
-
- // Notify the debug event listeners if break request.
- if (break_request) {
- Debugger::OnDebugBreak(Factory::undefined_value());
- }
+ // Notify the debug event listeners.
+ Debugger::OnDebugBreak(Factory::undefined_value());
// Return to continue execution.
return args[0];