Update V8 to r4588
We're using WebKit r58033, as used by
http://src.chromium.org/svn/releases/5.0.387.0/DEPS
This requires http://v8.googlecode.com/svn/trunk@4465 but this version has a
crashing bug for ARM. Instead we use http://v8.googlecode.com/svn/trunk@4588,
which is used by http://src.chromium.org/svn/releases/6.0.399.0/DEPS
Note that a trivial bug fix was required in arm/codegen-arm.cc. This is guarded
with ANDROID. See http://code.google.com/p/v8/issues/detail?id=703
Change-Id: I459647a8286c4f8c7405f0c5581ecbf051a6f1e8
diff --git a/src/handles.cc b/src/handles.cc
index c9a2877..1d4465f 100644
--- a/src/handles.cc
+++ b/src/handles.cc
@@ -174,13 +174,6 @@
}
-void SetExpectedNofPropertiesFromEstimate(Handle<JSFunction> func,
- int estimate) {
- SetExpectedNofProperties(
- func, ExpectedNofPropertiesFromEstimate(estimate));
-}
-
-
void NormalizeProperties(Handle<JSObject> object,
PropertyNormalizationMode mode,
int expected_additional_properties) {
@@ -203,13 +196,14 @@
void FlattenString(Handle<String> string) {
- CALL_HEAP_FUNCTION_VOID(string->TryFlattenIfNotFlat());
+ CALL_HEAP_FUNCTION_VOID(string->TryFlatten());
ASSERT(string->IsFlat());
}
Handle<Object> SetPrototype(Handle<JSFunction> function,
Handle<Object> prototype) {
+ ASSERT(function->should_have_prototype());
CALL_HEAP_FUNCTION(Accessors::FunctionSetPrototype(*function,
*prototype,
NULL),
@@ -292,6 +286,12 @@
}
+Handle<Object> GetElement(Handle<Object> obj,
+ uint32_t index) {
+ CALL_HEAP_FUNCTION(Runtime::GetElement(obj, index), Object);
+}
+
+
Handle<Object> GetPropertyWithInterceptor(Handle<JSObject> receiver,
Handle<JSObject> holder,
Handle<String> name,
@@ -371,8 +371,11 @@
}
-Handle<String> SubString(Handle<String> str, int start, int end) {
- CALL_HEAP_FUNCTION(str->SubString(start, end), String);
+Handle<String> SubString(Handle<String> str,
+ int start,
+ int end,
+ PretenureFlag pretenure) {
+ CALL_HEAP_FUNCTION(str->SubString(start, end, pretenure), String);
}
@@ -455,6 +458,16 @@
}
Handle<String> src(String::cast(script->source()));
+
+ Handle<FixedArray> array = CalculateLineEnds(src, true);
+
+ script->set_line_ends(*array);
+ ASSERT(script->line_ends()->IsFixedArray());
+}
+
+
+Handle<FixedArray> CalculateLineEnds(Handle<String> src,
+ bool with_imaginary_last_new_line) {
const int src_len = src->length();
Handle<String> new_line = Factory::NewStringFromAscii(CStrVector("\n"));
@@ -466,8 +479,12 @@
if (position != -1) {
position++;
}
- // Even if the last line misses a line end, it is counted.
- line_count++;
+ if (position != -1) {
+ line_count++;
+ } else if (with_imaginary_last_new_line) {
+ // Even if the last line misses a line end, it is counted.
+ line_count++;
+ }
}
// Pass 2: Fill in line ends positions
@@ -476,15 +493,17 @@
position = 0;
while (position != -1 && position < src_len) {
position = Runtime::StringMatch(src, new_line, position);
- // If the script does not end with a line ending add the final end
- // position as just past the last line ending.
- array->set(array_index++,
- Smi::FromInt(position != -1 ? position++ : src_len));
+ if (position != -1) {
+ array->set(array_index++, Smi::FromInt(position++));
+ } else if (with_imaginary_last_new_line) {
+ // If the script does not end with a line ending add the final end
+ // position as just past the last line ending.
+ array->set(array_index++, Smi::FromInt(src_len));
+ }
}
ASSERT(array_index == line_count);
- script->set_line_ends(*array);
- ASSERT(script->line_ends()->IsFixedArray());
+ return array;
}
@@ -514,8 +533,32 @@
}
+int GetScriptLineNumberSafe(Handle<Script> script, int code_pos) {
+ AssertNoAllocation no_allocation;
+ if (!script->line_ends()->IsUndefined()) {
+ return GetScriptLineNumber(script, code_pos);
+ }
+ // Slow mode: we do not have line_ends. We have to iterate through source.
+ if (!script->source()->IsString()) {
+ return -1;
+ }
+ String* source = String::cast(script->source());
+ int line = 0;
+ int len = source->length();
+ for (int pos = 0; pos < len; pos++) {
+ if (pos == code_pos) {
+ break;
+ }
+ if (source->Get(pos) == '\n') {
+ line++;
+ }
+ }
+ return line;
+}
+
+
void CustomArguments::IterateInstance(ObjectVisitor* v) {
- v->VisitPointers(values_, values_ + 4);
+ v->VisitPointers(values_, values_ + ARRAY_SIZE(values_));
}
@@ -711,7 +754,7 @@
ClearExceptionFlag flag) {
CompilationInfo info(function, 0, receiver);
bool result = CompileLazyHelper(&info, flag);
- LOG(FunctionCreateEvent(*function));
+ PROFILE(FunctionCreateEvent(*function));
return result;
}
@@ -721,7 +764,7 @@
ClearExceptionFlag flag) {
CompilationInfo info(function, 1, receiver);
bool result = CompileLazyHelper(&info, flag);
- LOG(FunctionCreateEvent(*function));
+ PROFILE(FunctionCreateEvent(*function));
return result;
}