Skip to content

Commit 7d425a0

Browse files
committed
Upgrade V8 to 3.0.3
1 parent 9eaf232 commit 7d425a0

File tree

159 files changed

+11579
-8047
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+11579
-8047
lines changed

deps/v8/ChangeLog

+12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2010-12-17: Version 3.0.3
2+
3+
Reapplied all changes for version 3.0.1.
4+
5+
Improved debugger protocol for remote debugging.
6+
7+
Added experimental support for using gyp to generate build files
8+
for V8.
9+
10+
Fixed implementation of String::Write in the API (issue 975).
11+
12+
113
2010-12-15: Version 3.0.2
214

315
Revert version 3.0.1 and patch 3.0.1.1.

deps/v8/include/v8-preparser.h

-7
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,6 @@ class UnicodeInputStream {
9999
// Returns the next Unicode code-point in the input, or a negative value when
100100
// there is no more input in the stream.
101101
virtual int32_t Next() = 0;
102-
103-
// Pushes a read character back into the stream, so that it will be the next
104-
// to be read by Advance(). The character pushed back must be the most
105-
// recently read character that hasn't already been pushed back (i.e., if
106-
// pushing back more than one character, they must occur in the opposite order
107-
// of the one they were read in).
108-
virtual void PushBack(int32_t ch) = 0;
109102
};
110103

111104

deps/v8/include/v8-profiler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ class V8EXPORT HeapGraphPath {
245245
class V8EXPORT HeapGraphNode {
246246
public:
247247
enum Type {
248-
kInternal = 0, // For compatibility, will be removed.
249248
kHidden = 0, // Hidden node, may be filtered when shown to user.
250249
kArray = 1, // An array of elements.
251250
kString = 2, // A string.
@@ -413,7 +412,8 @@ class V8EXPORT HeapProfiler {
413412
*/
414413
static const HeapSnapshot* TakeSnapshot(
415414
Handle<String> title,
416-
HeapSnapshot::Type type = HeapSnapshot::kFull);
415+
HeapSnapshot::Type type = HeapSnapshot::kFull,
416+
ActivityControl* control = NULL);
417417
};
418418

419419

deps/v8/include/v8.h

+26-3
Original file line numberDiff line numberDiff line change
@@ -992,18 +992,23 @@ class String : public Primitive {
992992
* the contents of the string and the NULL terminator into the
993993
* buffer.
994994
*
995+
* WriteUtf8 will not write partial UTF-8 sequences, preferring to stop
996+
* before the end of the buffer.
997+
*
995998
* Copies up to length characters into the output buffer.
996999
* Only null-terminates if there is enough space in the buffer.
9971000
*
9981001
* \param buffer The buffer into which the string will be copied.
9991002
* \param start The starting position within the string at which
10001003
* copying begins.
1001-
* \param length The number of bytes to copy from the string.
1004+
* \param length The number of characters to copy from the string. For
1005+
* WriteUtf8 the number of bytes in the buffer.
10021006
* \param nchars_ref The number of characters written, can be NULL.
10031007
* \param hints Various hints that might affect performance of this or
10041008
* subsequent operations.
1005-
* \return The number of bytes copied to the buffer
1006-
* excluding the NULL terminator.
1009+
* \return The number of characters copied to the buffer excluding the null
1010+
* terminator. For WriteUtf8: The number of bytes copied to the buffer
1011+
* including the null terminator.
10071012
*/
10081013
enum WriteHints {
10091014
NO_HINTS = 0,
@@ -3281,6 +3286,24 @@ class V8EXPORT OutputStream { // NOLINT
32813286
};
32823287

32833288

3289+
/**
3290+
* An interface for reporting progress and controlling long-running
3291+
* activities.
3292+
*/
3293+
class V8EXPORT ActivityControl { // NOLINT
3294+
public:
3295+
enum ControlOption {
3296+
kContinue = 0,
3297+
kAbort = 1
3298+
};
3299+
virtual ~ActivityControl() {}
3300+
/**
3301+
* Notify about current progress. The activity can be stopped by
3302+
* returning kAbort as the callback result.
3303+
*/
3304+
virtual ControlOption ReportProgressValue(int done, int total) = 0;
3305+
};
3306+
32843307

32853308
// --- I m p l e m e n t a t i o n ---
32863309

deps/v8/preparser/preparser-process.cc

+19-7
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ uint32_t ReadUInt32(FILE* source, bool* ok) {
127127

128128

129129
bool ReadBuffer(FILE* source, void* buffer, size_t length) {
130-
size_t actually_read = fread(buffer, 1, length, stdin);
130+
size_t actually_read = fread(buffer, 1, length, source);
131131
return (actually_read == length);
132132
}
133133

@@ -150,29 +150,34 @@ class ScopedPointer {
150150
};
151151

152152

153-
// Preparse stdin and output result on stdout.
154-
int PreParseIO() {
153+
// Preparse input and output result on stdout.
154+
int PreParseIO(FILE* input) {
155155
fprintf(stderr, "LOG: Enter parsing loop\n");
156156
bool ok = true;
157-
uint32_t length = ReadUInt32(stdin, &ok);
157+
uint32_t length = ReadUInt32(input, &ok);
158+
fprintf(stderr, "LOG: Input length: %d\n", length);
158159
if (!ok) return kErrorReading;
159160
ScopedPointer<uint8_t> buffer(new uint8_t[length]);
160161

161-
if (!ReadBuffer(stdin, *buffer, length)) {
162+
if (!ReadBuffer(input, *buffer, length)) {
162163
return kErrorReading;
163164
}
164165
UTF8InputStream input_buffer(*buffer, static_cast<size_t>(length));
165166

166167
v8::PreParserData data =
167-
v8::Preparse(&input_buffer, 64 * sizeof(void*)); // NOLINT
168+
v8::Preparse(&input_buffer, 64 * 1024 * sizeof(void*)); // NOLINT
168169
if (data.stack_overflow()) {
170+
fprintf(stderr, "LOG: Stack overflow\n");
171+
fflush(stderr);
169172
// Report stack overflow error/no-preparser-data.
170173
WriteUInt32(stdout, 0, &ok);
171174
if (!ok) return kErrorWriting;
172175
return 0;
173176
}
174177

175178
uint32_t size = data.size();
179+
fprintf(stderr, "LOG: Success, data size: %u\n", size);
180+
fflush(stderr);
176181
WriteUInt32(stdout, size, &ok);
177182
if (!ok) return kErrorWriting;
178183
if (!WriteBuffer(stdout, data.data(), size)) {
@@ -185,10 +190,17 @@ int PreParseIO() {
185190

186191

187192
int main(int argc, char* argv[]) {
193+
FILE* input = stdin;
194+
if (argc > 1) {
195+
char* arg = argv[1];
196+
input = fopen(arg, "rb");
197+
if (input == NULL) return EXIT_FAILURE;
198+
}
188199
int status = 0;
189200
do {
190-
status = v8::internal::PreParseIO();
201+
status = v8::internal::PreParseIO(input);
191202
} while (status == 0);
192203
fprintf(stderr, "EXIT: Failure %d\n", status);
204+
fflush(stderr);
193205
return EXIT_FAILURE;
194206
}

deps/v8/samples/samples.gyp

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright 2010 the V8 project authors. All rights reserved.
2+
# Redistribution and use in source and binary forms, with or without
3+
# modification, are permitted provided that the following conditions are
4+
# met:
5+
#
6+
# * Redistributions of source code must retain the above copyright
7+
# notice, this list of conditions and the following disclaimer.
8+
# * Redistributions in binary form must reproduce the above
9+
# copyright notice, this list of conditions and the following
10+
# disclaimer in the documentation and/or other materials provided
11+
# with the distribution.
12+
# * Neither the name of Google Inc. nor the names of its
13+
# contributors may be used to endorse or promote products derived
14+
# from this software without specific prior written permission.
15+
#
16+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27+
28+
{
29+
'targets': [
30+
{
31+
'target_name': 'shell',
32+
'type': 'executable',
33+
'dependencies': [
34+
'../tools/gyp/v8.gyp:v8',
35+
],
36+
'sources': [
37+
'shell.cc',
38+
],
39+
},
40+
{
41+
'target_name': 'process',
42+
'type': 'executable',
43+
'dependencies': [
44+
'../tools/gyp/v8.gyp:v8',
45+
],
46+
'sources': [
47+
'process.cc',
48+
],
49+
}
50+
],
51+
}

deps/v8/samples/shell.cc

-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ v8::Handle<v8::Value> Quit(const v8::Arguments& args);
4545
v8::Handle<v8::Value> Version(const v8::Arguments& args);
4646
v8::Handle<v8::String> ReadFile(const char* name);
4747
void ReportException(v8::TryCatch* handler);
48-
void SetFlagsFromString(const char* flags);
4948

5049

5150
int RunMain(int argc, char* argv[]) {
@@ -345,8 +344,3 @@ void ReportException(v8::TryCatch* try_catch) {
345344
}
346345
}
347346
}
348-
349-
350-
void SetFlagsFromString(const char* flags) {
351-
v8::V8::SetFlagsFromString(flags, strlen(flags));
352-
}

deps/v8/src/allocation.h

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
#ifndef V8_ALLOCATION_H_
2929
#define V8_ALLOCATION_H_
3030

31+
#include "checks.h"
32+
#include "globals.h"
33+
3134
namespace v8 {
3235
namespace internal {
3336

deps/v8/src/api.cc

+23-11
Original file line numberDiff line numberDiff line change
@@ -1165,14 +1165,22 @@ void ObjectTemplate::SetInternalFieldCount(int value) {
11651165

11661166

11671167
ScriptData* ScriptData::PreCompile(const char* input, int length) {
1168-
unibrow::Utf8InputBuffer<> buf(input, length);
1169-
return i::ParserApi::PreParse(i::Handle<i::String>(), &buf, NULL);
1168+
i::Utf8ToUC16CharacterStream stream(
1169+
reinterpret_cast<const unsigned char*>(input), length);
1170+
return i::ParserApi::PreParse(&stream, NULL);
11701171
}
11711172

11721173

11731174
ScriptData* ScriptData::PreCompile(v8::Handle<String> source) {
11741175
i::Handle<i::String> str = Utils::OpenHandle(*source);
1175-
return i::ParserApi::PreParse(str, NULL, NULL);
1176+
if (str->IsExternalTwoByteString()) {
1177+
i::ExternalTwoByteStringUC16CharacterStream stream(
1178+
i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
1179+
return i::ParserApi::PreParse(&stream, NULL);
1180+
} else {
1181+
i::GenericStringUC16CharacterStream stream(str, 0, str->length());
1182+
return i::ParserApi::PreParse(&stream, NULL);
1183+
}
11761184
}
11771185

11781186

@@ -3119,14 +3127,15 @@ int String::Write(uint16_t* buffer,
31193127
// using StringInputBuffer or Get(i) to access the characters.
31203128
str->TryFlatten();
31213129
}
3122-
int end = length;
3123-
if ( (length == -1) || (length > str->length() - start) )
3124-
end = str->length() - start;
3130+
int end = start + length;
3131+
if ((length == -1) || (length > str->length() - start) )
3132+
end = str->length();
31253133
if (end < 0) return 0;
31263134
i::String::WriteToFlat(*str, buffer, start, end);
3127-
if (length == -1 || end < length)
3128-
buffer[end] = '\0';
3129-
return end;
3135+
if (length == -1 || end - start < length) {
3136+
buffer[end - start] = '\0';
3137+
}
3138+
return end - start;
31303139
}
31313140

31323141

@@ -4939,7 +4948,8 @@ const HeapSnapshot* HeapProfiler::FindSnapshot(unsigned uid) {
49394948

49404949

49414950
const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
4942-
HeapSnapshot::Type type) {
4951+
HeapSnapshot::Type type,
4952+
ActivityControl* control) {
49434953
IsDeadCheck("v8::HeapProfiler::TakeSnapshot");
49444954
i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
49454955
switch (type) {
@@ -4953,7 +4963,8 @@ const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
49534963
UNREACHABLE();
49544964
}
49554965
return reinterpret_cast<const HeapSnapshot*>(
4956-
i::HeapProfiler::TakeSnapshot(*Utils::OpenHandle(*title), internal_type));
4966+
i::HeapProfiler::TakeSnapshot(
4967+
*Utils::OpenHandle(*title), internal_type, control));
49574968
}
49584969

49594970
#endif // ENABLE_LOGGING_AND_PROFILING
@@ -4968,6 +4979,7 @@ void Testing::SetStressRunType(Testing::StressType type) {
49684979
}
49694980

49704981
int Testing::GetStressRuns() {
4982+
if (internal::FLAG_stress_runs != 0) return internal::FLAG_stress_runs;
49714983
#ifdef DEBUG
49724984
// In debug mode the code runs much slower so stressing will only make two
49734985
// runs.

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -5592,6 +5592,12 @@ void CodeGenerator::GenerateSwapElements(ZoneList<Expression*>* args) {
55925592
__ tst(tmp2, Operand(kSmiTagMask));
55935593
deferred->Branch(nz);
55945594

5595+
// Check that both indices are valid.
5596+
__ ldr(tmp2, FieldMemOperand(object, JSArray::kLengthOffset));
5597+
__ cmp(tmp2, index1);
5598+
__ cmp(tmp2, index2, hi);
5599+
deferred->Branch(ls);
5600+
55955601
// Bring the offsets into the fixed array in tmp1 into index1 and
55965602
// index2.
55975603
__ mov(tmp2, Operand(FixedArray::kHeaderSize - kHeapObjectTag));
@@ -6463,7 +6469,7 @@ void CodeGenerator::VisitCompareOperation(CompareOperation* node) {
64636469
case Token::INSTANCEOF: {
64646470
Load(left);
64656471
Load(right);
6466-
InstanceofStub stub;
6472+
InstanceofStub stub(InstanceofStub::kNoFlags);
64676473
frame_->CallStub(&stub, 2);
64686474
// At this point if instanceof succeeded then r0 == 0.
64696475
__ tst(r0, Operand(r0));

0 commit comments

Comments
 (0)