Skip to content

Commit

Permalink
Version 3.9.21
Browse files Browse the repository at this point in the history
Fixed push-to-trunk script (and re-push).

Added API call that identifies strings that are guaranteed only to contain ASCII characters.

git-svn-id: https://v8.googlecode.com/svn/trunk@11082 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
  • Loading branch information
[email protected] committed Mar 19, 2012
1 parent cddc1a0 commit 4968897
Show file tree
Hide file tree
Showing 73 changed files with 1,436 additions and 506 deletions.
33 changes: 33 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
2012-03-19: Version 3.9.21

Fixed push-to-trunk script (and re-push).

Added API call that identifies strings that are guaranteed only to
contain ASCII characters.


2012-03-19: Version 3.9.20

Fixed declarations escaping global strict eval. (Issue 1624)

Fixed wrapping of receiver for non-strict callbacks. (Issue 1973)

Fixed function declarations overwriting read-only global properties.
(Chromium issue 115452)

Fixed --use-strict flag in combination with --harmony[-scoping].

Debugger: naive implementation of "step into Function.prototype.bind".

Debugger: added ability to set script source from within OnBeforeCompile

Added flag to always call DebugBreak on abort.

Re-enabled constructor inlining and inline === comparison with boolean
constants. (Issue 2009)

Don't use an explicit s0 in ClampDoubleToUint8. (Issue 2004)

Performance and stability improvements on all platforms.


2012-03-14: Version 3.9.19

Ensure there is a smi check of the receiver for global load and call
Expand Down
7 changes: 7 additions & 0 deletions benchmarks/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,10 @@ input strings.
Furthermore, the benchmark runner was changed to run the benchmarks
for at least a few times to stabilize the reported numbers on slower
machines.


Changes from Version 6 to Version 7
===================================

Added the Navier-Stokes benchmark, a 2D differential equation solver
that stresses arithmetic computations on double arrays.
4 changes: 4 additions & 0 deletions benchmarks/revisions.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
the benchmark suite.

</p>
<div class="subtitle"><h3>Version 7 (<a href="http://v8.googlecode.com/svn/data/benchmarks/v7/run.html">link</a>)</h3></div>

<p>This version includes the new Navier-Stokes benchmark, a 2D differential
equation solver that stresses arithmetic computations on double arrays.</p>

<div class="subtitle"><h3>Version 6 (<a href="http://v8.googlecode.com/svn/data/benchmarks/v6/run.html">link</a>)</h3></div>

Expand Down
20 changes: 10 additions & 10 deletions benchmarks/run.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@
BenchmarkSuite.RunSuites({ NotifyStep: ShowProgress,
NotifyError: AddError,
NotifyResult: AddResult,
NotifyScore: AddScore });
NotifyScore: AddScore });
}

function ShowWarningIfObsolete() {
// If anything goes wrong we will just catch the exception and no
// If anything goes wrong we will just catch the exception and no
// warning is shown, i.e., no harm is done.
try {
var xmlhttp;
var next_version = parseInt(BenchmarkSuite.version) + 1;
var next_version_url = "../v" + next_version + "/run.html";
var next_version = parseInt(BenchmarkSuite.version) + 1;
var next_version_url = "../v" + next_version + "/run.html";
if (window.XMLHttpRequest) {
xmlhttp = new window.XMLHttpRequest();
} else if (window.ActiveXObject) {
Expand All @@ -76,27 +76,27 @@
};
xmlhttp.send(null);
} catch(e) {
// Ignore exception if check for next version fails.
// Ignore exception if check for next version fails.
// Hence no warning is displayed.
}
}

function Load() {
var version = BenchmarkSuite.version;
document.getElementById("version").innerHTML = version;
ShowWarningIfObsolete();
ShowWarningIfObsolete();
setTimeout(Run, 200);
}
</script>
</head>
<body onload="Load()">
<div>
<div class="title"><h1>V8 Benchmark Suite - version <span id="version">?</span></h1></div>
<div class="warning" id="obsolete">
<div class="warning" id="obsolete">
Warning! This is not the latest version of the V8 benchmark
suite. Consider running the
suite. Consider running the
<a href="http://v8.googlecode.com/svn/data/benchmarks/current/run.html">
latest version</a>.
latest version</a>.
</div>
<table>
<tr>
Expand All @@ -118,7 +118,7 @@
(<i>1761 lines</i>).
</li>
<li><b>Splay</b><br>Data manipulation benchmark that deals with splay trees and exercises the automatic memory management subsystem (<i>394 lines</i>).</li>
<li><b>NavierStokes (beta)</b><br>Solves NavierStokes equations in 2D, heavily manipulating double precision arrays. Based on Oliver Hunt's code (<i>396 lines</i>).</li>
<li><b>NavierStokes</b><br>Solves NavierStokes equations in 2D, heavily manipulating double precision arrays. Based on Oliver Hunt's code (<i>387 lines</i>).</li>
</ul>

<p>
Expand Down
8 changes: 8 additions & 0 deletions include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,14 @@ class String : public Primitive {
*/
V8EXPORT int Utf8Length() const;

/**
* A fast conservative check for non-ASCII characters. May
* return true even for ASCII strings, but if it returns
* false you can be sure that all characters are in the range
* 0-127.
*/
V8EXPORT bool MayContainNonAscii() const;

/**
* Write the contents of the string to an external buffer.
* If no arguments are given, expects the buffer to be large
Expand Down
9 changes: 9 additions & 0 deletions src/api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3694,6 +3694,15 @@ int String::Utf8Length() const {
}


bool String::MayContainNonAscii() const {
i::Handle<i::String> str = Utils::OpenHandle(this);
if (IsDeadCheck(str->GetIsolate(), "v8::String::MayContainNonAscii()")) {
return false;
}
return !str->HasOnlyAsciiChars();
}


int String::WriteUtf8(char* buffer,
int capacity,
int* nchars_ref,
Expand Down
45 changes: 29 additions & 16 deletions src/arm/full-codegen-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1410,6 +1410,16 @@ void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
}


void FullCodeGenerator::EmitAccessor(Expression* expression) {
if (expression == NULL) {
__ LoadRoot(r1, Heap::kNullValueRootIndex);
__ push(r1);
} else {
VisitForStackValue(expression);
}
}


void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
Comment cmnt(masm_, "[ ObjectLiteral");
Handle<FixedArray> constant_properties = expr->constant_properties();
Expand Down Expand Up @@ -1445,6 +1455,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
// marked expressions, no store code is emitted.
expr->CalculateEmitStore();

AccessorTable accessor_table(isolate()->zone());
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
if (property->IsCompileTimeValue()) continue;
Expand Down Expand Up @@ -1493,27 +1504,29 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
}
break;
case ObjectLiteral::Property::GETTER:
accessor_table.lookup(key)->second->getter = value;
break;
case ObjectLiteral::Property::SETTER:
// Duplicate receiver on stack.
__ ldr(r0, MemOperand(sp));
__ push(r0);
VisitForStackValue(key);
if (property->kind() == ObjectLiteral::Property::GETTER) {
VisitForStackValue(value);
__ LoadRoot(r1, Heap::kNullValueRootIndex);
__ push(r1);
} else {
__ LoadRoot(r1, Heap::kNullValueRootIndex);
__ push(r1);
VisitForStackValue(value);
}
__ mov(r0, Operand(Smi::FromInt(NONE)));
__ push(r0);
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
accessor_table.lookup(key)->second->setter = value;
break;
}
}

// Emit code to define accessors, using only a single call to the runtime for
// each pair of corresponding getters and setters.
for (AccessorTable::Iterator it = accessor_table.begin();
it != accessor_table.end();
++it) {
__ ldr(r0, MemOperand(sp)); // Duplicate receiver.
__ push(r0);
VisitForStackValue(it->first);
EmitAccessor(it->second->getter);
EmitAccessor(it->second->setter);
__ mov(r0, Operand(Smi::FromInt(NONE)));
__ push(r0);
__ CallRuntime(Runtime::kDefineOrRedefineAccessorProperty, 5);
}

if (expr->has_function()) {
ASSERT(result_saved);
__ ldr(r0, MemOperand(sp));
Expand Down
4 changes: 2 additions & 2 deletions src/arm/macro-assembler-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3647,8 +3647,8 @@ void MacroAssembler::ClampDoubleToUint8(Register result_reg,
bind(&in_bounds);
Vmov(temp_double_reg, 0.5);
vadd(temp_double_reg, input_reg, temp_double_reg);
vcvt_u32_f64(s0, temp_double_reg);
vmov(result_reg, s0);
vcvt_u32_f64(temp_double_reg.low(), temp_double_reg);
vmov(result_reg, temp_double_reg.low());
bind(&done);
}

Expand Down
2 changes: 0 additions & 2 deletions src/ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,6 @@ void AstConstructionVisitor::VisitForStatement(ForStatement* node) {

void AstConstructionVisitor::VisitForInStatement(ForInStatement* node) {
increase_node_count();
add_flag(kDontOptimize);
add_flag(kDontInline);
add_flag(kDontSelfOptimize);
}

Expand Down
6 changes: 6 additions & 0 deletions src/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -1366,6 +1366,12 @@ class ObjectLiteral: public MaterializedLiteral {
kHasFunction = 1 << 1
};

struct Accessors: public ZoneObject {
Accessors() : getter(NULL), setter(NULL) { }
Expression* getter;
Expression* setter;
};

protected:
template<class> friend class AstNodeFactory;

Expand Down
20 changes: 7 additions & 13 deletions src/builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -508,8 +508,7 @@ BUILTIN(ArrayPush) {
}
FixedArray* new_elms = FixedArray::cast(obj);

AssertNoAllocation no_gc;
CopyObjectToObjectElements(&no_gc, elms, FAST_ELEMENTS, 0,
CopyObjectToObjectElements(elms, FAST_ELEMENTS, 0,
new_elms, FAST_ELEMENTS, 0, len);
FillWithHoles(heap, new_elms, new_length, capacity);

Expand Down Expand Up @@ -645,8 +644,7 @@ BUILTIN(ArrayUnshift) {
if (!maybe_obj->ToObject(&obj)) return maybe_obj;
}
FixedArray* new_elms = FixedArray::cast(obj);
AssertNoAllocation no_gc;
CopyObjectToObjectElements(&no_gc, elms, FAST_ELEMENTS, 0,
CopyObjectToObjectElements(elms, FAST_ELEMENTS, 0,
new_elms, FAST_ELEMENTS, to_add, len);
FillWithHoles(heap, new_elms, new_length, capacity);
elms = new_elms;
Expand Down Expand Up @@ -757,8 +755,7 @@ BUILTIN(ArraySlice) {
JSArray* result_array;
if (!maybe_array->To(&result_array)) return maybe_array;

AssertNoAllocation no_gc;
CopyObjectToObjectElements(&no_gc, elms, FAST_ELEMENTS, k,
CopyObjectToObjectElements(elms, FAST_ELEMENTS, k,
FixedArray::cast(result_array->elements()),
FAST_ELEMENTS, 0, result_len);

Expand Down Expand Up @@ -831,9 +828,8 @@ BUILTIN(ArraySplice) {
if (!maybe_array->To(&result_array)) return maybe_array;

{
AssertNoAllocation no_gc;
// Fill newly created array.
CopyObjectToObjectElements(&no_gc, elms, FAST_ELEMENTS, actual_start,
CopyObjectToObjectElements(elms, FAST_ELEMENTS, actual_start,
FixedArray::cast(result_array->elements()),
FAST_ELEMENTS, 0, actual_delete_count);
}
Expand Down Expand Up @@ -883,12 +879,11 @@ BUILTIN(ArraySplice) {
FixedArray* new_elms = FixedArray::cast(obj);

{
AssertNoAllocation no_gc;
// Copy the part before actual_start as is.
CopyObjectToObjectElements(&no_gc, elms, FAST_ELEMENTS, 0,
CopyObjectToObjectElements(elms, FAST_ELEMENTS, 0,
new_elms, FAST_ELEMENTS, 0, actual_start);
const int to_copy = len - actual_delete_count - actual_start;
CopyObjectToObjectElements(&no_gc, elms, FAST_ELEMENTS,
CopyObjectToObjectElements(elms, FAST_ELEMENTS,
actual_start + actual_delete_count,
new_elms, FAST_ELEMENTS,
actual_start + item_count, to_copy);
Expand Down Expand Up @@ -973,14 +968,13 @@ BUILTIN(ArrayConcat) {
if (result_len == 0) return result_array;

// Copy data.
AssertNoAllocation no_gc;
int start_pos = 0;
FixedArray* result_elms(FixedArray::cast(result_array->elements()));
for (int i = 0; i < n_arguments; i++) {
JSArray* array = JSArray::cast(args[i]);
int len = Smi::cast(array->length())->value();
FixedArray* elms = FixedArray::cast(array->elements());
CopyObjectToObjectElements(&no_gc, elms, FAST_ELEMENTS, 0,
CopyObjectToObjectElements(elms, FAST_ELEMENTS, 0,
result_elms, FAST_ELEMENTS,
start_pos, len);
start_pos += len;
Expand Down
7 changes: 6 additions & 1 deletion src/compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,9 @@ static Handle<SharedFunctionInfo> MakeFunctionInfo(CompilationInfo* info) {
// the instances of the function.
SetExpectedNofPropertiesFromEstimate(result, lit->expected_property_count());

script->set_compilation_state(
Smi::FromInt(Script::COMPILATION_STATE_COMPILED));

#ifdef ENABLE_DEBUGGER_SUPPORT
// Notify debugger
isolate->debugger()->OnAfterCompile(
Expand Down Expand Up @@ -521,7 +524,9 @@ Handle<SharedFunctionInfo> Compiler::Compile(Handle<String> source,
info.MarkAsGlobal();
info.SetExtension(extension);
info.SetPreParseData(pre_data);
if (FLAG_use_strict) info.SetLanguageMode(STRICT_MODE);
if (FLAG_use_strict) {
info.SetLanguageMode(FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE);
}
result = MakeFunctionInfo(&info);
if (extension == NULL && !result.is_null()) {
compilation_cache->PutScript(source, result);
Expand Down
25 changes: 21 additions & 4 deletions src/debug.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,18 @@ void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared) {
}


void Debug::FloodBoundFunctionWithOneShot(Handle<JSFunction> function) {
Handle<FixedArray> new_bindings(function->function_bindings());
Handle<Object> bindee(new_bindings->get(JSFunction::kBoundFunctionIndex));

if (!bindee.is_null() && bindee->IsJSFunction() &&
!JSFunction::cast(*bindee)->IsBuiltin()) {
Handle<SharedFunctionInfo> shared_info(JSFunction::cast(*bindee)->shared());
Debug::FloodWithOneShot(shared_info);
}
}


void Debug::FloodHandlerWithOneShot() {
// Iterate through the JavaScript stack looking for handlers.
StackFrame::Id id = break_frame_id();
Expand Down Expand Up @@ -1442,8 +1454,10 @@ void Debug::PrepareStep(StepAction step_action, int step_count) {
expressions_count - 2 - call_function_arg_count);
if (fun->IsJSFunction()) {
Handle<JSFunction> js_function(JSFunction::cast(fun));
// Don't step into builtins.
if (!js_function->IsBuiltin()) {
if (js_function->shared()->bound()) {
Debug::FloodBoundFunctionWithOneShot(js_function);
} else if (!js_function->IsBuiltin()) {
// Don't step into builtins.
// It will also compile target function if it's not compiled yet.
FloodWithOneShot(Handle<SharedFunctionInfo>(js_function->shared()));
}
Expand Down Expand Up @@ -1639,8 +1653,11 @@ void Debug::HandleStepIn(Handle<JSFunction> function,
// Flood the function with one-shot break points if it is called from where
// step into was requested.
if (fp == step_in_fp()) {
// Don't allow step into functions in the native context.
if (!function->IsBuiltin()) {
if (function->shared()->bound()) {
// Handle Function.prototype.bind
Debug::FloodBoundFunctionWithOneShot(function);
} else if (!function->IsBuiltin()) {
// Don't allow step into functions in the native context.
if (function->shared()->code() ==
Isolate::Current()->builtins()->builtin(Builtins::kFunctionApply) ||
function->shared()->code() ==
Expand Down
Loading

0 comments on commit 4968897

Please sign in to comment.