Author: [email protected]
Date: Wed Apr 15 06:27:32 2009
New Revision: 1717
Added:
trunk/test/mjsunit/const-declaration.js
- copied unchanged from r1716,
/branches/bleeding_edge/test/mjsunit/const-declaration.js
trunk/test/mjsunit/override-read-only-property.js
- copied unchanged from r1716,
/branches/bleeding_edge/test/mjsunit/override-read-only-property.js
trunk/test/mjsunit/regress/regress-312.js
- copied unchanged from r1716,
/branches/bleeding_edge/test/mjsunit/regress/regress-312.js
trunk/test/mjsunit/tools/
- copied from r1716, /branches/bleeding_edge/test/mjsunit/tools/
trunk/test/mjsunit/tools/splaytree.js
- copied unchanged from r1716,
/branches/bleeding_edge/test/mjsunit/tools/splaytree.js
trunk/tools/splaytree.js
- copied unchanged from r1716,
/branches/bleeding_edge/tools/splaytree.js
Modified:
trunk/ (props changed)
trunk/ChangeLog
trunk/samples/process.cc
trunk/src/api.cc
trunk/src/codegen-arm.cc
trunk/src/codegen-ia32.cc
trunk/src/codegen.cc
trunk/src/d8-posix.cc
trunk/src/func-name-inferrer.h
trunk/src/mirror-delay.js
trunk/src/mksnapshot.cc
trunk/src/parser.cc
trunk/src/prettyprinter.cc
trunk/src/regexp-macro-assembler-irregexp-inl.h (props changed)
trunk/src/virtual-frame-arm.h
trunk/test/cctest/test-api.cc
trunk/test/cctest/test-debug.cc
trunk/test/mjsunit/global-load-from-eval-in-with.js (props changed)
trunk/test/mjsunit/local-load-from-eval.js (props changed)
trunk/test/mjsunit/property-load-across-eval.js (props changed)
trunk/test/mjsunit/regress/regress-269.js (props changed)
trunk/test/mjsunit/testcfg.py
Log:
Fixed crash bug that occurred when loading a const variable in the presence
of eval.
Allowed using with and eval in registered extensions in debug mode by
fixing bogus assert.
Fixed the source position for function returns to enable the debugger to
break there.
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Wed Apr 15 06:27:32 2009
@@ -1,3 +1,15 @@
+2009-04-15: Version 1.1.10
+
+ Fixed crash bug that occurred when loading a const variable in the
+ presence of eval.
+
+ Allowed using with and eval in registered extensions in debug mode
+ by fixing bogus assert.
+
+ Fixed the source position for function returns to enable the
+ debugger to break there.
+
+
2009-04-14: Version 1.1.9
Made the stack traversal code in the profiler robust by avoiding
Modified: trunk/samples/process.cc
==============================================================================
--- trunk/samples/process.cc (original)
+++ trunk/samples/process.cc Wed Apr 15 06:27:32 2009
@@ -27,8 +27,6 @@
#include <v8.h>
-// To avoid warnings from <map> on windows we disable exceptions.
-#define _HAS_EXCEPTIONS 0
#include <string>
#include <map>
Modified: trunk/src/api.cc
==============================================================================
--- trunk/src/api.cc (original)
+++ trunk/src/api.cc Wed Apr 15 06:27:32 2009
@@ -2373,7 +2373,7 @@
const char* v8::V8::GetVersion() {
- return "1.1.9.1";
+ return "1.1.10";
}
Modified: trunk/src/codegen-arm.cc
==============================================================================
--- trunk/src/codegen-arm.cc (original)
+++ trunk/src/codegen-arm.cc Wed Apr 15 06:27:32 2009
@@ -2446,8 +2446,13 @@
r1,
r2,
&slow));
+ if (potential_slot->var()->mode() == Variable::CONST) {
+ __ cmp(r0, Operand(Factory::the_hole_value()));
+ __ mov(r0, Operand(Factory::undefined_value()), LeaveCC, eq);
+ }
// There is always control flow to slow from
- // ContextSlotOperandCheckExtensions.
+ // ContextSlotOperandCheckExtensions so we have to jump around
+ // it.
done.Jump();
}
}
Modified: trunk/src/codegen-ia32.cc
==============================================================================
--- trunk/src/codegen-ia32.cc (original)
+++ trunk/src/codegen-ia32.cc Wed Apr 15 06:27:32 2009
@@ -3286,8 +3286,14 @@
ContextSlotOperandCheckExtensions(potential_slot,
value,
&slow));
+ if (potential_slot->var()->mode() == Variable::CONST) {
+ __ cmp(value.reg(), Factory::the_hole_value());
+ done.Branch(not_equal, &value);
+ __ mov(value.reg(), Factory::undefined_value());
+ }
// There is always control flow to slow from
- // ContextSlotOperandCheckExtensions.
+ // ContextSlotOperandCheckExtensions so we have to jump around
+ // it.
done.Jump(&value);
}
}
Modified: trunk/src/codegen.cc
==============================================================================
--- trunk/src/codegen.cc (original)
+++ trunk/src/codegen.cc Wed Apr 15 06:27:32 2009
@@ -571,7 +571,7 @@
void CodeGenerator::CodeForReturnPosition(FunctionLiteral* fun) {
if (FLAG_debug_info) {
- int pos = fun->start_position();
+ int pos = fun->end_position();
if (pos != RelocInfo::kNoPosition) {
masm()->RecordStatementPosition(pos);
masm()->RecordPosition(pos);
Modified: trunk/src/d8-posix.cc
==============================================================================
--- trunk/src/d8-posix.cc (original)
+++ trunk/src/d8-posix.cc Wed Apr 15 06:27:32 2009
@@ -105,17 +105,17 @@
// Returns false on timeout, true on data ready.
static bool WaitOnFD(int fd,
int read_timeout,
- int* total_timeout,
+ int total_timeout,
struct timeval& start_time) {
fd_set readfds, writefds, exceptfds;
struct timeval timeout;
- if (*total_timeout != -1) {
+ int gone = 0;
+ if (total_timeout != -1) {
struct timeval time_now;
gettimeofday(&time_now, NULL);
int seconds = time_now.tv_sec - start_time.tv_sec;
- int gone = seconds * 1000 + (time_now.tv_usec - start_time.tv_usec) /
1000;
- if (gone >= *total_timeout) return false;
- *total_timeout -= gone;
+ gone = seconds * 1000 + (time_now.tv_usec - start_time.tv_usec) / 1000;
+ if (gone >= total_timeout) return false;
}
FD_ZERO(&readfds);
FD_ZERO(&writefds);
@@ -123,8 +123,8 @@
FD_SET(fd, &readfds);
FD_SET(fd, &exceptfds);
if (read_timeout == -1 ||
- (*total_timeout != -1 && *total_timeout < read_timeout)) {
- read_timeout = *total_timeout;
+ (total_timeout != -1 && total_timeout - gone < read_timeout)) {
+ read_timeout = total_timeout - gone;
}
timeout.tv_usec = (read_timeout % 1000) * 1000;
timeout.tv_sec = read_timeout / 1000;
@@ -306,7 +306,7 @@
static Handle<Value> GetStdout(int child_fd,
struct timeval& start_time,
int read_timeout,
- int* total_timeout) {
+ int total_timeout) {
Handle<String> accumulator = String::Empty();
const char* source = "function(a, b) { return a + b; }";
Handle<Value> cons_as_obj(Script::Compile(String::New(source))->Run());
@@ -332,7 +332,7 @@
read_timeout,
total_timeout,
start_time) ||
- (TimeIsOut(start_time, *total_timeout))) {
+ (TimeIsOut(start_time, total_timeout))) {
return ThrowException(String::New("Timed out waiting for
output"));
}
continue;
@@ -502,7 +502,7 @@
Handle<Value> accumulator = GetStdout(stdout_fds[kReadFD],
start_time,
read_timeout,
- &total_timeout);
+ total_timeout);
if (accumulator->IsUndefined()) {
kill(pid, SIGINT); // On timeout, kill the subprocess.
return accumulator;
Modified: trunk/src/func-name-inferrer.h
==============================================================================
--- trunk/src/func-name-inferrer.h (original)
+++ trunk/src/func-name-inferrer.h Wed Apr 15 06:27:32 2009
@@ -70,7 +70,8 @@
void SetFuncToInfer(FunctionLiteral* func_to_infer) {
if (IsOpen()) {
- ASSERT(func_to_infer_ == NULL);
+ // If we encounter another function literal after already having
+ // encountered one, the second one replaces the first.
func_to_infer_ = func_to_infer;
}
}
Modified: trunk/src/mirror-delay.js
==============================================================================
--- trunk/src/mirror-delay.js (original)
+++ trunk/src/mirror-delay.js Wed Apr 15 06:27:32 2009
@@ -1715,8 +1715,8 @@
// Collect the JSON property/value pairs in an array.
var content = new Array();
- // Add the handle for value mirrors.
- if (mirror.isValue()) {
+ // Add the mirror handle.
+ if (mirror.isValue() || mirror.isScript()) {
content.push(MakeJSONPair_('handle', NumberToJSON_(mirror.handle())));
}
@@ -1771,10 +1771,11 @@
break;
case SCRIPT_TYPE:
- // Script is represented by name and source attributes.
+ // Script is represented by id, name and source attributes.
if (mirror.name()) {
content.push(MakeJSONPair_('name', StringToJSON_(mirror.name())));
}
+ content.push(MakeJSONPair_('id', NumberToJSON_(mirror.id())));
content.push(MakeJSONPair_('lineOffset',
NumberToJSON_(mirror.lineOffset())));
content.push(MakeJSONPair_('columnOffset',
@@ -1908,7 +1909,12 @@
content.push(MakeJSONPair_('index', NumberToJSON_(mirror.index())));
content.push(MakeJSONPair_('receiver',
this.serializeReference(mirror.receiver())));
- content.push(MakeJSONPair_('func',
this.serializeReference(mirror.func())));
+ var func = mirror.func();
+ content.push(MakeJSONPair_('func', this.serializeReference(func)));
+ if (func.script()) {
+ content.push(MakeJSONPair_('script',
+ this.serializeReference(func.script())));
+ }
content.push(MakeJSONPair_('constructCall',
BooleanToJSON_(mirror.isConstructCall())));
content.push(MakeJSONPair_('debuggerFrame',
Modified: trunk/src/mksnapshot.cc
==============================================================================
--- trunk/src/mksnapshot.cc (original)
+++ trunk/src/mksnapshot.cc Wed Apr 15 06:27:32 2009
@@ -25,8 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// To avoid warnings from <map> on windows we disable exceptions.
-#define _HAS_EXCEPTIONS 0
#include <signal.h>
#include <string>
#include <map>
Modified: trunk/src/parser.cc
==============================================================================
--- trunk/src/parser.cc (original)
+++ trunk/src/parser.cc Wed Apr 15 06:27:32 2009
@@ -2092,7 +2092,7 @@
// code. If 'with' statements were allowed, the simplified setup of
// the runtime context chain would allow access to properties in the
// global object from within a 'with' statement.
- ASSERT(!Bootstrapper::IsActive());
+ ASSERT(extension_ != NULL || !Bootstrapper::IsActive());
Expect(Token::WITH, CHECK_OK);
Expect(Token::LPAREN, CHECK_OK);
@@ -2761,7 +2761,7 @@
if (var == NULL) {
// We do not allow direct calls to 'eval' in our internal
// JS files. Use builtin functions instead.
- ASSERT(!Bootstrapper::IsActive());
+ ASSERT(extension_ != NULL || !Bootstrapper::IsActive());
top_scope_->RecordEvalCall();
is_potentially_direct_eval = true;
}
Modified: trunk/src/prettyprinter.cc
==============================================================================
--- trunk/src/prettyprinter.cc (original)
+++ trunk/src/prettyprinter.cc Wed Apr 15 06:27:32 2009
@@ -646,7 +646,7 @@
void AstPrinter::PrintIndented(const char* txt) {
for (int i = 0; i < indent_; i++) {
- Print(". ");
+ Print(". ");
}
Print(txt);
}
@@ -732,7 +732,7 @@
if (scope->num_parameters() > 0) {
IndentedScope indent("PARAMS");
for (int i = 0; i < scope->num_parameters(); i++) {
- PrintLiteralWithModeIndented("VAR ", scope->parameter(i),
+ PrintLiteralWithModeIndented("VAR", scope->parameter(i),
scope->parameter(i)->name(),
scope->parameter(i)->type());
}
@@ -1024,7 +1024,7 @@
Visit(node->obj());
Literal* literal = node->key()->AsLiteral();
if (literal != NULL && literal->handle()->IsSymbol()) {
- PrintLiteralIndented("LITERAL", literal->handle(), false);
+ PrintLiteralIndented("NAME", literal->handle(), false);
} else {
PrintIndentedVisit("KEY", node->key());
}
Modified: trunk/src/virtual-frame-arm.h
==============================================================================
--- trunk/src/virtual-frame-arm.h (original)
+++ trunk/src/virtual-frame-arm.h Wed Apr 15 06:27:32 2009
@@ -85,7 +85,7 @@
}
bool is_used(Register reg) {
- return is_used(reg.code()) != kIllegalIndex;
+ return is_used(reg.code());
}
// Add extra in-memory elements to the top of the frame to match an
actual
Modified: trunk/test/cctest/test-api.cc
==============================================================================
--- trunk/test/cctest/test-api.cc (original)
+++ trunk/test/cctest/test-api.cc Wed Apr 15 06:27:32 2009
@@ -2495,6 +2495,44 @@
}
+static const char* kEvalExtensionSource =
+ "function UseEval() {"
+ " var x = 42;"
+ " return eval('x');"
+ "}";
+
+
+THREADED_TEST(UseEvalFromExtension) {
+ v8::HandleScope handle_scope;
+ v8::RegisterExtension(new Extension("evaltest", kEvalExtensionSource));
+ const char* extension_names[] = { "evaltest" };
+ v8::ExtensionConfiguration extensions(1, extension_names);
+ v8::Handle<Context> context = Context::New(&extensions);
+ Context::Scope lock(context);
+ v8::Handle<Value> result = Script::Compile(v8_str("UseEval()"))->Run();
+ CHECK_EQ(result, v8::Integer::New(42));
+}
+
+
+static const char* kWithExtensionSource =
+ "function UseWith() {"
+ " var x = 42;"
+ " with({x:87}) { return x; }"
+ "}";
+
+
+THREADED_TEST(UseWithFromExtension) {
+ v8::HandleScope handle_scope;
+ v8::RegisterExtension(new Extension("withtest", kWithExtensionSource));
+ const char* extension_names[] = { "withtest" };
+ v8::ExtensionConfiguration extensions(1, extension_names);
+ v8::Handle<Context> context = Context::New(&extensions);
+ Context::Scope lock(context);
+ v8::Handle<Value> result = Script::Compile(v8_str("UseWith()"))->Run();
+ CHECK_EQ(result, v8::Integer::New(87));
+}
+
+
THREADED_TEST(AutoExtensions) {
v8::HandleScope handle_scope;
Extension* extension = new Extension("autotest", kSimpleExtensionSource);
Modified: trunk/test/cctest/test-debug.cc
==============================================================================
--- trunk/test/cctest/test-debug.cc (original)
+++ trunk/test/cctest/test-debug.cc Wed Apr 15 06:27:32 2009
@@ -498,7 +498,7 @@
// ---
-// Source for The JavaScript function which picks out the function name on
the
+// Source for The JavaScript function which picks out the function name of
the
// top frame.
const char* frame_function_name_source =
"function frame_function_name(exec_state) {"
@@ -507,6 +507,24 @@
v8::Local<v8::Function> frame_function_name;
+// Source for The JavaScript function which picks out the source line for
the
+// top frame.
+const char* frame_source_line_source =
+ "function frame_source_line(exec_state) {"
+ " return exec_state.frame(0).sourceLine();"
+ "}";
+v8::Local<v8::Function> frame_source_line;
+
+
+// Source for The JavaScript function which picks out the source column
for the
+// top frame.
+const char* frame_source_column_source =
+ "function frame_source_column(exec_state) {"
+ " return exec_state.frame(0).sourceColumn();"
+ "}";
+v8::Local<v8::Function> frame_source_column;
+
+
// Source for The JavaScript function which returns the number of frames.
static const char* frame_count_source =
"function frame_count(exec_state) {"
@@ -518,6 +536,10 @@
// Global variable to store the last function hit - used by some tests.
char last_function_hit[80];
+// Global variables to store the last source position - used by some tests.
+int last_source_line = -1;
+int last_source_column = -1;
+
// Debug event handler which counts the break points which have been hit.
int break_point_hit_count = 0;
static void DebugEventBreakPointHitCount(v8::DebugEvent event,
@@ -544,6 +566,26 @@
function_name->WriteAscii(last_function_hit);
}
}
+
+ if (!frame_source_line.IsEmpty()) {
+ // Get the source line.
+ const int argc = 1;
+ v8::Handle<v8::Value> argv[argc] = { exec_state };
+ v8::Handle<v8::Value> result = frame_source_line->Call(exec_state,
+ argc, argv);
+ CHECK(result->IsNumber());
+ last_source_line = result->Int32Value();
+ }
+
+ if (!frame_source_column.IsEmpty()) {
+ // Get the source column.
+ const int argc = 1;
+ v8::Handle<v8::Value> argv[argc] = { exec_state };
+ v8::Handle<v8::Value> result = frame_source_column->Call(exec_state,
+ argc, argv);
+ CHECK(result->IsNumber());
+ last_source_column = result->Int32Value();
+ }
}
}
@@ -994,6 +1036,17 @@
break_point_hit_count = 0;
v8::HandleScope scope;
DebugLocalContext env;
+
+ // Create a functions for checking the source line and column when
hitting
+ // a break point.
+ frame_source_line = CompileFunction(&env,
+ frame_source_line_source,
+ "frame_source_line");
+ frame_source_column = CompileFunction(&env,
+ frame_source_column_source,
+ "frame_source_column");
+
+
v8::Debug::SetDebugEventListener(DebugEventBreakPointHitCount,
v8::Undefined());
v8::Script::Compile(v8::String::New("function foo(){}"))->Run();
@@ -1008,8 +1061,12 @@
int bp = SetBreakPoint(foo, 0);
foo->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
+ CHECK_EQ(0, last_source_line);
+ CHECK_EQ(16, last_source_column);
foo->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
+ CHECK_EQ(0, last_source_line);
+ CHECK_EQ(16, last_source_column);
// Run without breakpoints.
ClearBreakPoint(bp);
@@ -3661,15 +3718,6 @@
int dummy_length = AsciiToUtf16(dummy_command, dummy_buffer);
v8::Debug::SendCommand(dummy_buffer, dummy_length);
}
-
-
-// Source for a JavaScript function which returns the source line for the
top
-// frame.
-static const char* frame_source_line_source =
- "function frame_source_line(exec_state) {"
- " return exec_state.frame(0).sourceLine();"
- "}";
-v8::Handle<v8::Function> frame_source_line;
// Source for a JavaScript function which returns the data parameter of a
Modified: trunk/test/mjsunit/testcfg.py
==============================================================================
--- trunk/test/mjsunit/testcfg.py (original)
+++ trunk/test/mjsunit/testcfg.py Wed Apr 15 06:27:32 2009
@@ -32,6 +32,7 @@
FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)")
+FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
class MjsunitTestCase(test.TestCase):
@@ -54,6 +55,12 @@
flags_match = FLAGS_PATTERN.search(source)
if flags_match:
result += flags_match.group(1).strip().split()
+ files_match = FILES_PATTERN.search(source);
+ additional_files = []
+ if files_match:
+ additional_files += files_match.group(1).strip().split()
+ for a_file in additional_files:
+ result.append(join(dirname(self.config.root), '..', a_file))
framework = join(dirname(self.config.root), 'mjsunit', 'mjsunit.js')
result += [framework, self.file]
return result
@@ -76,7 +83,8 @@
mjsunit = [current_path + [t] for t in self.Ls(self.root)]
regress = [current_path + ['regress', t] for t in
self.Ls(join(self.root, 'regress'))]
bugs = [current_path + ['bugs', t] for t in
self.Ls(join(self.root, 'bugs'))]
- all_tests = mjsunit + regress + bugs
+ tools = [current_path + ['tools', t] for t in
self.Ls(join(self.root, 'tools'))]
+ all_tests = mjsunit + regress + bugs + tools
result = []
for test in all_tests:
if self.Contains(path, test):
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---