Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(777)

Unified Diff: src/api.cc

Issue 6580038: [Isolates] Merge from bleeding_edge, revisions 5934-6100. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/allocation.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
===================================================================
--- src/api.cc (revision 6904)
+++ src/api.cc (working copy)
@@ -1193,14 +1193,22 @@
ScriptData* ScriptData::PreCompile(const char* input, int length) {
- unibrow::Utf8InputBuffer<> buf(input, length);
- return i::ParserApi::PreParse(i::Handle<i::String>(), &buf, NULL);
+ i::Utf8ToUC16CharacterStream stream(
+ reinterpret_cast<const unsigned char*>(input), length);
+ return i::ParserApi::PreParse(&stream, NULL);
}
ScriptData* ScriptData::PreCompile(v8::Handle<String> source) {
i::Handle<i::String> str = Utils::OpenHandle(*source);
- return i::ParserApi::PreParse(str, NULL, NULL);
+ if (str->IsExternalTwoByteString()) {
+ i::ExternalTwoByteStringUC16CharacterStream stream(
+ i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
+ return i::ParserApi::PreParse(&stream, NULL);
+ } else {
+ i::GenericStringUC16CharacterStream stream(str, 0, str->length());
+ return i::ParserApi::PreParse(&stream, NULL);
+ }
}
@@ -3088,14 +3096,15 @@
// using StringInputBuffer or Get(i) to access the characters.
str->TryFlatten();
}
- int end = length;
- if ( (length == -1) || (length > str->length() - start) )
- end = str->length() - start;
+ int end = start + length;
+ if ((length == -1) || (length > str->length() - start) )
+ end = str->length();
if (end < 0) return 0;
i::String::WriteToFlat(*str, buffer, start, end);
- if (length == -1 || end < length)
- buffer[end] = '\0';
- return end;
+ if (length == -1 || end - start < length) {
+ buffer[end - start] = '\0';
+ }
+ return end - start;
}
@@ -3778,6 +3787,36 @@
}
+void v8::Date::DateTimeConfigurationChangeNotification() {
+ ON_BAILOUT("v8::Date::DateTimeConfigurationChangeNotification()", return);
+ LOG_API("Date::DateTimeConfigurationChangeNotification");
+ ENTER_V8;
+
+ HandleScope scope;
+ i::Isolate* isolate = i::Isolate::Current();
+ // Get the function ResetDateCache (defined in date-delay.js).
+ i::Handle<i::String> func_name_str =
+ isolate->factory()->LookupAsciiSymbol("ResetDateCache");
+ i::MaybeObject* result =
+ isolate->js_builtins_object()->GetProperty(*func_name_str);
+ i::Object* object_func;
+ if (!result->ToObject(&object_func)) {
+ return;
+ }
+
+ if (object_func->IsJSFunction()) {
+ i::Handle<i::JSFunction> func =
+ i::Handle<i::JSFunction>(i::JSFunction::cast(object_func));
+
+ // Call ResetDateCache(0 but expect no exceptions:
+ bool caught_exception = false;
+ i::Handle<i::Object> result =
+ i::Execution::TryCall(func, isolate->js_builtins_object(), 0, NULL,
+ &caught_exception);
+ }
+}
+
+
static i::Handle<i::String> RegExpFlagsToString(RegExp::Flags flags) {
char flags_buf[3];
int num_flags = 0;
@@ -4974,7 +5013,8 @@
const HeapSnapshot* HeapProfiler::TakeSnapshot(Handle<String> title,
- HeapSnapshot::Type type) {
+ HeapSnapshot::Type type,
+ ActivityControl* control) {
IsDeadCheck("v8::HeapProfiler::TakeSnapshot");
i::HeapSnapshot::Type internal_type = i::HeapSnapshot::kFull;
switch (type) {
@@ -4988,7 +5028,8 @@
UNREACHABLE();
}
return reinterpret_cast<const HeapSnapshot*>(
- i::HeapProfiler::TakeSnapshot(*Utils::OpenHandle(*title), internal_type));
+ i::HeapProfiler::TakeSnapshot(
+ *Utils::OpenHandle(*title), internal_type, control));
}
#endif // ENABLE_LOGGING_AND_PROFILING
@@ -5003,6 +5044,7 @@
}
int Testing::GetStressRuns() {
+ if (internal::FLAG_stress_runs != 0) return internal::FLAG_stress_runs;
#ifdef DEBUG
// In debug mode the code runs much slower so stressing will only make two
// runs.
« no previous file with comments | « src/allocation.h ('k') | src/arm/code-stubs-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698