Skip to content

Commit de3c16a

Browse files
committed
Upgrade V8 to 3.6.6.14
1 parent 2255efa commit de3c16a

14 files changed

+383
-79
lines changed

deps/v8/src/api.cc

+32-25
Original file line numberDiff line numberDiff line change
@@ -1456,31 +1456,35 @@ Local<Script> Script::New(v8::Handle<String> source,
14561456
ON_BAILOUT(isolate, "v8::Script::New()", return Local<Script>());
14571457
LOG_API(isolate, "Script::New");
14581458
ENTER_V8(isolate);
1459-
i::Handle<i::String> str = Utils::OpenHandle(*source);
1460-
i::Handle<i::Object> name_obj;
1461-
int line_offset = 0;
1462-
int column_offset = 0;
1463-
if (origin != NULL) {
1464-
if (!origin->ResourceName().IsEmpty()) {
1465-
name_obj = Utils::OpenHandle(*origin->ResourceName());
1466-
}
1467-
if (!origin->ResourceLineOffset().IsEmpty()) {
1468-
line_offset = static_cast<int>(origin->ResourceLineOffset()->Value());
1459+
i::SharedFunctionInfo* raw_result = NULL;
1460+
{ i::HandleScope scope(isolate);
1461+
i::Handle<i::String> str = Utils::OpenHandle(*source);
1462+
i::Handle<i::Object> name_obj;
1463+
int line_offset = 0;
1464+
int column_offset = 0;
1465+
if (origin != NULL) {
1466+
if (!origin->ResourceName().IsEmpty()) {
1467+
name_obj = Utils::OpenHandle(*origin->ResourceName());
1468+
}
1469+
if (!origin->ResourceLineOffset().IsEmpty()) {
1470+
line_offset = static_cast<int>(origin->ResourceLineOffset()->Value());
1471+
}
1472+
if (!origin->ResourceColumnOffset().IsEmpty()) {
1473+
column_offset =
1474+
static_cast<int>(origin->ResourceColumnOffset()->Value());
1475+
}
14691476
}
1470-
if (!origin->ResourceColumnOffset().IsEmpty()) {
1471-
column_offset = static_cast<int>(origin->ResourceColumnOffset()->Value());
1477+
EXCEPTION_PREAMBLE(isolate);
1478+
i::ScriptDataImpl* pre_data_impl =
1479+
static_cast<i::ScriptDataImpl*>(pre_data);
1480+
// We assert that the pre-data is sane, even though we can actually
1481+
// handle it if it turns out not to be in release mode.
1482+
ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck());
1483+
// If the pre-data isn't sane we simply ignore it
1484+
if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) {
1485+
pre_data_impl = NULL;
14721486
}
1473-
}
1474-
EXCEPTION_PREAMBLE(isolate);
1475-
i::ScriptDataImpl* pre_data_impl = static_cast<i::ScriptDataImpl*>(pre_data);
1476-
// We assert that the pre-data is sane, even though we can actually
1477-
// handle it if it turns out not to be in release mode.
1478-
ASSERT(pre_data_impl == NULL || pre_data_impl->SanityCheck());
1479-
// If the pre-data isn't sane we simply ignore it
1480-
if (pre_data_impl != NULL && !pre_data_impl->SanityCheck()) {
1481-
pre_data_impl = NULL;
1482-
}
1483-
i::Handle<i::SharedFunctionInfo> result =
1487+
i::Handle<i::SharedFunctionInfo> result =
14841488
i::Compiler::Compile(str,
14851489
name_obj,
14861490
line_offset,
@@ -1489,8 +1493,11 @@ Local<Script> Script::New(v8::Handle<String> source,
14891493
pre_data_impl,
14901494
Utils::OpenHandle(*script_data),
14911495
i::NOT_NATIVES_CODE);
1492-
has_pending_exception = result.is_null();
1493-
EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>());
1496+
has_pending_exception = result.is_null();
1497+
EXCEPTION_BAILOUT_CHECK(isolate, Local<Script>());
1498+
raw_result = *result;
1499+
}
1500+
i::Handle<i::SharedFunctionInfo> result(raw_result, isolate);
14941501
return Local<Script>(ToApi<Script>(result));
14951502
}
14961503

deps/v8/src/arm/lithium-codegen-arm.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -2992,11 +2992,11 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
29922992
__ and_(scratch, result, Operand(HeapNumber::kSignMask));
29932993

29942994
__ Vmov(double_scratch0(), 0.5);
2995-
__ vadd(input, input, double_scratch0());
2995+
__ vadd(double_scratch0(), input, double_scratch0());
29962996

29972997
// Check sign of the result: if the sign changed, the input
29982998
// value was in ]0.5, 0[ and the result should be -0.
2999-
__ vmov(result, input.high());
2999+
__ vmov(result, double_scratch0().high());
30003000
__ eor(result, result, Operand(scratch), SetCC);
30013001
if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
30023002
DeoptimizeIf(mi, instr->environment());
@@ -3007,7 +3007,7 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
30073007

30083008
__ EmitVFPTruncate(kRoundToMinusInf,
30093009
double_scratch0().low(),
3010-
input,
3010+
double_scratch0(),
30113011
result,
30123012
scratch);
30133013
DeoptimizeIf(ne, instr->environment());

deps/v8/src/ia32/lithium-codegen-ia32.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -2770,12 +2770,12 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
27702770
__ movdbl(xmm_scratch, Operand::StaticVariable(one_half));
27712771
__ ucomisd(xmm_scratch, input_reg);
27722772
__ j(above, &below_half);
2773-
// input = input + 0.5
2774-
__ addsd(input_reg, xmm_scratch);
2773+
// xmm_scratch = input + 0.5
2774+
__ addsd(xmm_scratch, input_reg);
27752775

27762776
// Compute Math.floor(value + 0.5).
27772777
// Use truncating instruction (OK because input is positive).
2778-
__ cvttsd2si(output_reg, Operand(input_reg));
2778+
__ cvttsd2si(output_reg, Operand(xmm_scratch));
27792779

27802780
// Overflow is signalled with minint.
27812781
__ cmp(output_reg, 0x80000000u);

deps/v8/src/mark-compact.cc

+49-24
Original file line numberDiff line numberDiff line change
@@ -665,13 +665,19 @@ class StaticMarkingVisitor : public StaticVisitorBase {
665665
}
666666

667667
// Only flush code for functions.
668-
if (shared_info->code()->kind() != Code::FUNCTION) return false;
668+
if (shared_info->code()->kind() != Code::FUNCTION) {
669+
return false;
670+
}
669671

670672
// Function must be lazy compilable.
671-
if (!shared_info->allows_lazy_compilation()) return false;
673+
if (!shared_info->allows_lazy_compilation()) {
674+
return false;
675+
}
672676

673677
// If this is a full script wrapped in a function we do no flush the code.
674-
if (shared_info->is_toplevel()) return false;
678+
if (shared_info->is_toplevel()) {
679+
return false;
680+
}
675681

676682
// Age this shared function info.
677683
if (shared_info->code_age() < kCodeAgeThreshold) {
@@ -864,21 +870,7 @@ class StaticMarkingVisitor : public StaticVisitorBase {
864870
collector->MarkObject(jsfunction->unchecked_shared()->unchecked_code());
865871

866872
if (jsfunction->unchecked_code()->kind() == Code::OPTIMIZED_FUNCTION) {
867-
// For optimized functions we should retain both non-optimized version
868-
// of it's code and non-optimized version of all inlined functions.
869-
// This is required to support bailing out from inlined code.
870-
DeoptimizationInputData* data =
871-
reinterpret_cast<DeoptimizationInputData*>(
872-
jsfunction->unchecked_code()->unchecked_deoptimization_data());
873-
874-
FixedArray* literals = data->UncheckedLiteralArray();
875-
876-
for (int i = 0, count = data->InlinedFunctionCount()->value();
877-
i < count;
878-
i++) {
879-
JSFunction* inlined = reinterpret_cast<JSFunction*>(literals->get(i));
880-
collector->MarkObject(inlined->unchecked_shared()->unchecked_code());
881-
}
873+
collector->MarkInlinedFunctionsCode(jsfunction->unchecked_code());
882874
}
883875
}
884876

@@ -994,9 +986,7 @@ class CodeMarkingVisitor : public ThreadVisitor {
994986
: collector_(collector) {}
995987

996988
void VisitThread(Isolate* isolate, ThreadLocalTop* top) {
997-
for (StackFrameIterator it(isolate, top); !it.done(); it.Advance()) {
998-
collector_->MarkObject(it.frame()->unchecked_code());
999-
}
989+
collector_->PrepareThreadForCodeFlushing(isolate, top);
1000990
}
1001991

1002992
private:
@@ -1027,6 +1017,42 @@ class SharedFunctionInfoMarkingVisitor : public ObjectVisitor {
10271017
};
10281018

10291019

1020+
void MarkCompactCollector::MarkInlinedFunctionsCode(Code* code) {
1021+
// For optimized functions we should retain both non-optimized version
1022+
// of it's code and non-optimized version of all inlined functions.
1023+
// This is required to support bailing out from inlined code.
1024+
DeoptimizationInputData* data =
1025+
reinterpret_cast<DeoptimizationInputData*>(
1026+
code->unchecked_deoptimization_data());
1027+
1028+
FixedArray* literals = data->UncheckedLiteralArray();
1029+
1030+
for (int i = 0, count = data->InlinedFunctionCount()->value();
1031+
i < count;
1032+
i++) {
1033+
JSFunction* inlined = reinterpret_cast<JSFunction*>(literals->get(i));
1034+
MarkObject(inlined->unchecked_shared()->unchecked_code());
1035+
}
1036+
}
1037+
1038+
1039+
void MarkCompactCollector::PrepareThreadForCodeFlushing(Isolate* isolate,
1040+
ThreadLocalTop* top) {
1041+
for (StackFrameIterator it(isolate, top); !it.done(); it.Advance()) {
1042+
// Note: for the frame that has a pending lazy deoptimization
1043+
// StackFrame::unchecked_code will return a non-optimized code object for
1044+
// the outermost function and StackFrame::LookupCode will return
1045+
// actual optimized code object.
1046+
StackFrame* frame = it.frame();
1047+
Code* code = frame->unchecked_code();
1048+
MarkObject(code);
1049+
if (frame->is_optimized()) {
1050+
MarkInlinedFunctionsCode(frame->LookupCode());
1051+
}
1052+
}
1053+
}
1054+
1055+
10301056
void MarkCompactCollector::PrepareForCodeFlushing() {
10311057
ASSERT(heap() == Isolate::Current()->heap());
10321058

@@ -1050,9 +1076,8 @@ void MarkCompactCollector::PrepareForCodeFlushing() {
10501076

10511077
// Make sure we are not referencing the code from the stack.
10521078
ASSERT(this == heap()->mark_compact_collector());
1053-
for (StackFrameIterator it; !it.done(); it.Advance()) {
1054-
MarkObject(it.frame()->unchecked_code());
1055-
}
1079+
PrepareThreadForCodeFlushing(heap()->isolate(),
1080+
heap()->isolate()->thread_local_top());
10561081

10571082
// Iterate the archived stacks in all threads to check if
10581083
// the code is referenced.

deps/v8/src/mark-compact.h

+12
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ class MarkingStack {
9696
};
9797

9898

99+
// Defined in isolate.h.
100+
class ThreadLocalTop;
101+
102+
99103
// -------------------------------------------------------------------------
100104
// Mark-Compact collector
101105

@@ -253,6 +257,14 @@ class MarkCompactCollector {
253257
friend class CodeMarkingVisitor;
254258
friend class SharedFunctionInfoMarkingVisitor;
255259

260+
// Mark non-optimize code for functions inlined into the given optimized
261+
// code. This will prevent it from being flushed.
262+
void MarkInlinedFunctionsCode(Code* code);
263+
264+
// Mark code objects that are active on the stack to prevent them
265+
// from being flushed.
266+
void PrepareThreadForCodeFlushing(Isolate* isolate, ThreadLocalTop* top);
267+
256268
void PrepareForCodeFlushing();
257269

258270
// Marking operations for objects reachable from roots.

deps/v8/src/parser.cc

+15-13
Original file line numberDiff line numberDiff line change
@@ -2036,6 +2036,20 @@ Statement* Parser::ParseReturnStatement(bool* ok) {
20362036
// reported (underlining).
20372037
Expect(Token::RETURN, CHECK_OK);
20382038

2039+
Token::Value tok = peek();
2040+
Statement* result;
2041+
if (scanner().HasAnyLineTerminatorBeforeNext() ||
2042+
tok == Token::SEMICOLON ||
2043+
tok == Token::RBRACE ||
2044+
tok == Token::EOS) {
2045+
ExpectSemicolon(CHECK_OK);
2046+
result = new(zone()) ReturnStatement(GetLiteralUndefined());
2047+
} else {
2048+
Expression* expr = ParseExpression(true, CHECK_OK);
2049+
ExpectSemicolon(CHECK_OK);
2050+
result = new(zone()) ReturnStatement(expr);
2051+
}
2052+
20392053
// An ECMAScript program is considered syntactically incorrect if it
20402054
// contains a return statement that is not within the body of a
20412055
// function. See ECMA-262, section 12.9, page 67.
@@ -2048,19 +2062,7 @@ Statement* Parser::ParseReturnStatement(bool* ok) {
20482062
Expression* throw_error = NewThrowSyntaxError(type, Handle<Object>::null());
20492063
return new(zone()) ExpressionStatement(throw_error);
20502064
}
2051-
2052-
Token::Value tok = peek();
2053-
if (scanner().HasAnyLineTerminatorBeforeNext() ||
2054-
tok == Token::SEMICOLON ||
2055-
tok == Token::RBRACE ||
2056-
tok == Token::EOS) {
2057-
ExpectSemicolon(CHECK_OK);
2058-
return new(zone()) ReturnStatement(GetLiteralUndefined());
2059-
}
2060-
2061-
Expression* expr = ParseExpression(true, CHECK_OK);
2062-
ExpectSemicolon(CHECK_OK);
2063-
return new(zone()) ReturnStatement(expr);
2065+
return result;
20642066
}
20652067

20662068

deps/v8/src/preparser.cc

+1
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ PreParser::Statement PreParser::ParseDoWhileStatement(bool* ok) {
540540
Expect(i::Token::LPAREN, CHECK_OK);
541541
ParseExpression(true, CHECK_OK);
542542
Expect(i::Token::RPAREN, ok);
543+
if (peek() == i::Token::SEMICOLON) Consume(i::Token::SEMICOLON);
543544
return Statement::Default();
544545
}
545546

deps/v8/src/v8threads.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class ThreadState {
7272
};
7373

7474

75-
// Defined in top.h
75+
// Defined in isolate.h.
7676
class ThreadLocalTop;
7777

7878

deps/v8/src/version.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define MAJOR_VERSION 3
3636
#define MINOR_VERSION 6
3737
#define BUILD_NUMBER 6
38-
#define PATCH_LEVEL 11
38+
#define PATCH_LEVEL 14
3939
// Use 1 for candidates and 0 otherwise.
4040
// (Boolean macro values are not supported by all preprocessors.)
4141
#define IS_CANDIDATE_VERSION 0

deps/v8/src/x64/lithium-codegen-x64.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -2773,10 +2773,10 @@ void LCodeGen::DoMathRound(LUnaryMathOperation* instr) {
27732773
// This addition might give a result that isn't the correct for
27742774
// rounding, due to loss of precision, but only for a number that's
27752775
// so big that the conversion below will overflow anyway.
2776-
__ addsd(input_reg, xmm_scratch);
2776+
__ addsd(xmm_scratch, input_reg);
27772777
// Compute Math.floor(input).
27782778
// Use truncating instruction (OK because input is positive).
2779-
__ cvttsd2si(output_reg, input_reg);
2779+
__ cvttsd2si(output_reg, xmm_scratch);
27802780
// Overflow is signalled with minint.
27812781
__ cmpl(output_reg, Immediate(0x80000000));
27822782
DeoptimizeIf(equal, instr->environment());

0 commit comments

Comments
 (0)