Skip to content

Commit b16d9c2

Browse files
committed
deps: upgrade v8 to 4.2.77.20
Fixes: #1637 PR-URL: #1639 Reviewed-By: Trevor Norris <[email protected]> V8-Bug: https://code.google.com/p/v8/issues/detail?id=3960 V8-Bug: https://code.google.com/p/v8/issues/detail?id=4079
1 parent 8315b22 commit b16d9c2

15 files changed

+76
-27
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 4
1212
#define V8_MINOR_VERSION 2
1313
#define V8_BUILD_NUMBER 77
14-
#define V8_PATCH_LEVEL 18
14+
#define V8_PATCH_LEVEL 20
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/compiler.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(
14551455
result->set_is_toplevel(false);
14561456

14571457
RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, result);
1458-
result->set_allows_lazy_compilation(allow_lazy);
1458+
result->set_allows_lazy_compilation(literal->AllowsLazyCompilation());
14591459
result->set_allows_lazy_compilation_without_context(allow_lazy_without_ctx);
14601460

14611461
// Set the expected number of properties for instances and return

deps/v8/src/compiler/graph-visualizer.h

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#ifndef V8_COMPILER_GRAPH_VISUALIZER_H_
66
#define V8_COMPILER_GRAPH_VISUALIZER_H_
77

8+
#include <stdio.h>
89
#include <iosfwd>
910

1011
namespace v8 {

deps/v8/src/debug.cc

+27-14
Original file line numberDiff line numberDiff line change
@@ -1604,23 +1604,22 @@ Handle<Object> Debug::GetSourceBreakLocations(
16041604
Handle<FixedArray> locations =
16051605
isolate->factory()->NewFixedArray(debug_info->GetBreakPointCount());
16061606
int count = 0;
1607-
for (int i = 0; i < debug_info->break_points()->length(); i++) {
1607+
for (int i = 0; i < debug_info->break_points()->length(); ++i) {
16081608
if (!debug_info->break_points()->get(i)->IsUndefined()) {
16091609
BreakPointInfo* break_point_info =
16101610
BreakPointInfo::cast(debug_info->break_points()->get(i));
1611-
if (break_point_info->GetBreakPointCount() > 0) {
1612-
Smi* position = NULL;
1613-
switch (position_alignment) {
1614-
case STATEMENT_ALIGNED:
1615-
position = break_point_info->statement_position();
1616-
break;
1617-
case BREAK_POSITION_ALIGNED:
1618-
position = break_point_info->source_position();
1619-
break;
1620-
}
1621-
1622-
locations->set(count++, position);
1611+
int break_points = break_point_info->GetBreakPointCount();
1612+
if (break_points == 0) continue;
1613+
Smi* position = NULL;
1614+
switch (position_alignment) {
1615+
case STATEMENT_ALIGNED:
1616+
position = break_point_info->statement_position();
1617+
break;
1618+
case BREAK_POSITION_ALIGNED:
1619+
position = break_point_info->source_position();
1620+
break;
16231621
}
1622+
for (int j = 0; j < break_points; ++j) locations->set(count++, position);
16241623
}
16251624
}
16261625
return locations;
@@ -1923,7 +1922,6 @@ static void RecompileAndRelocateSuspendedGenerators(
19231922
static bool SkipSharedFunctionInfo(SharedFunctionInfo* shared,
19241923
Object* active_code_marker) {
19251924
if (!shared->allows_lazy_compilation()) return true;
1926-
if (!shared->script()->IsScript()) return true;
19271925
Object* script = shared->script();
19281926
if (!script->IsScript()) return true;
19291927
if (Script::cast(script)->type()->value() == Script::TYPE_NATIVE) return true;
@@ -2204,6 +2202,21 @@ Object* Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
22042202
}
22052203
} // End while loop.
22062204

2205+
// JSFunctions from the same literal may not have the same shared function
2206+
// info. Find those JSFunctions and deduplicate the shared function info.
2207+
HeapIterator iterator(heap, FLAG_lazy ? HeapIterator::kNoFiltering
2208+
: HeapIterator::kFilterUnreachable);
2209+
for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
2210+
if (!obj->IsJSFunction()) continue;
2211+
JSFunction* function = JSFunction::cast(obj);
2212+
SharedFunctionInfo* shared = function->shared();
2213+
if (shared != *target && shared->script() == target->script() &&
2214+
shared->start_position_and_type() ==
2215+
target->start_position_and_type()) {
2216+
function->set_shared(*target);
2217+
}
2218+
}
2219+
22072220
return *target;
22082221
}
22092222

deps/v8/src/factory.cc

+2-7
Original file line numberDiff line numberDiff line change
@@ -826,17 +826,12 @@ Handle<ExecutableAccessorInfo> Factory::NewExecutableAccessorInfo() {
826826

827827

828828
Handle<Script> Factory::NewScript(Handle<String> source) {
829-
// Generate id for this script.
830-
Heap* heap = isolate()->heap();
831-
int id = heap->last_script_id()->value() + 1;
832-
if (!Smi::IsValid(id) || id < 0) id = 1;
833-
heap->set_last_script_id(Smi::FromInt(id));
834-
835829
// Create and initialize script object.
830+
Heap* heap = isolate()->heap();
836831
Handle<Script> script = Handle<Script>::cast(NewStruct(SCRIPT_TYPE));
837832
script->set_source(*source);
838833
script->set_name(heap->undefined_value());
839-
script->set_id(Smi::FromInt(id));
834+
script->set_id(isolate()->heap()->NextScriptId());
840835
script->set_line_offset(Smi::FromInt(0));
841836
script->set_column_offset(Smi::FromInt(0));
842837
script->set_context_data(heap->undefined_value());

deps/v8/src/heap/heap.h

+8
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,14 @@ class Heap {
13391339
return seed;
13401340
}
13411341

1342+
Smi* NextScriptId() {
1343+
int next_id = last_script_id()->value() + 1;
1344+
if (!Smi::IsValid(next_id) || next_id < 0) next_id = 1;
1345+
Smi* next_id_smi = Smi::FromInt(next_id);
1346+
set_last_script_id(next_id_smi);
1347+
return next_id_smi;
1348+
}
1349+
13421350
void SetArgumentsAdaptorDeoptPCOffset(int pc_offset) {
13431351
DCHECK(arguments_adaptor_deopt_pc_offset() == Smi::FromInt(0));
13441352
set_arguments_adaptor_deopt_pc_offset(Smi::FromInt(pc_offset));

deps/v8/src/liveedit.cc

+1
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ void LiveEdit::SetFunctionScript(Handle<JSValue> function_wrapper,
12381238
UnwrapSharedFunctionInfoFromJSValue(function_wrapper);
12391239
CHECK(script_handle->IsScript() || script_handle->IsUndefined());
12401240
shared_info->set_script(*script_handle);
1241+
shared_info->DisableOptimization(kLiveEdit);
12411242

12421243
function_wrapper->GetIsolate()->compilation_cache()->Remove(shared_info);
12431244
}

deps/v8/src/runtime/runtime-debug.cc

+10
Original file line numberDiff line numberDiff line change
@@ -2327,6 +2327,7 @@ RUNTIME_FUNCTION(Runtime_DebugGetLoadedScripts) {
23272327
HandleScope scope(isolate);
23282328
DCHECK(args.length() == 0);
23292329

2330+
DebugScope debug_scope(isolate->debug());
23302331
// Fill the script objects.
23312332
Handle<FixedArray> instances = isolate->debug()->GetLoadedScripts();
23322333

@@ -2674,6 +2675,15 @@ RUNTIME_FUNCTION(Runtime_ExecuteInDebugContext) {
26742675
}
26752676

26762677

2678+
RUNTIME_FUNCTION(Runtime_GetDebugContext) {
2679+
HandleScope scope(isolate);
2680+
DCHECK(args.length() == 0);
2681+
Handle<Context> context = isolate->debug()->GetDebugContext();
2682+
context->set_security_token(isolate->native_context()->security_token());
2683+
return context->global_proxy();
2684+
}
2685+
2686+
26772687
// Performs a GC.
26782688
// Presently, it only does a full GC.
26792689
RUNTIME_FUNCTION(Runtime_CollectGarbage) {

deps/v8/src/runtime/runtime.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ namespace internal {
577577
F(LiveEditRestartFrame, 2, 1) \
578578
F(GetFunctionCodePositionFromSource, 2, 1) \
579579
F(ExecuteInDebugContext, 2, 1) \
580-
\
580+
F(GetDebugContext, 0, 1) \
581581
F(SetFlags, 1, 1) \
582582
F(CollectGarbage, 1, 1) \
583583
F(GetHeapUsage, 0, 1)

deps/v8/src/serialize.cc

+2
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,8 @@ HeapObject* Deserializer::ProcessNewObjectFromSerializedCode(HeapObject* obj) {
820820
string->SetForwardedInternalizedString(canonical);
821821
return canonical;
822822
}
823+
} else if (obj->IsScript()) {
824+
Script::cast(obj)->set_id(isolate_->heap()->NextScriptId());
823825
}
824826
return obj;
825827
}

deps/v8/test/mjsunit/debug-breakpoints.js

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
// Get the Debug object exposed from the debug context global object.
3030
Debug = debug.Debug
3131

32+
Debug.setListener(function() {});
33+
3234
function f() {a=1;b=2}
3335
function g() {
3436
a=1;

deps/v8/test/mjsunit/debug-liveedit-2.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727

28-
// Flags: --expose-debug-as debug
28+
// Flags: --expose-debug-as debug --noalways-opt
2929
// Get the Debug object exposed from the debug context global object.
3030

3131

deps/v8/test/mjsunit/debug-liveedit-4.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727

28-
// Flags: --expose-debug-as debug
28+
// Flags: --expose-debug-as debug --noalways-opt
2929
// Get the Debug object exposed from the debug context global object.
3030

3131
// In this test case we edit a script so that techincally function text
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2015 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --allow-natives-syntax --cache=code
6+
// Test that script ids are unique and we found the correct ones.
7+
8+
var scripts = %DebugGetLoadedScripts();
9+
scripts.sort(function(a, b) { return a.id - b.id; });
10+
var user_script_count = 0;
11+
scripts.reduce(function(prev, cur) {
12+
assertTrue(prev === undefined || prev.id != cur.id);
13+
if (cur.type == 2) user_script_count++;
14+
});
15+
16+
// Found mjsunit.js and this script.
17+
assertEquals(2, user_script_count);

deps/v8/test/mjsunit/regress/regress-2825.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// Do not edit this file with an editor that replaces \r with \r\n.
88
// Variable definitions for i0 through i3 are each terminated with \r.
99
function f() {
10-
var i0 = 0; var i1 = 1; var i2 = 2; var i3 = 3;
10+
var i0 = 0; var i1 = 1; var i2 = 2; var i3 = 3;
1111
var j0 = 0;
1212
var j1 = 1;
1313
var j2 = 2;

0 commit comments

Comments
 (0)