Version 3.23.11
Deprecate old versions of Isolate::SetData and GetData.
Performance and stability improvements on all platforms.
git-svn-id: http://v8.googlecode.com/svn/trunk@18041 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/ChangeLog b/ChangeLog
index 73bfe96..fa508c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
- 2013-11-22: Version 3.23.10
+2013-11-25: Version 3.23.11
+
+ Deprecate old versions of Isolate::SetData and GetData.
+
+ Performance and stability improvements on all platforms.
+
+
+2013-11-22: Version 3.23.10
Remove preemption thread and API.
(issue 3004)
diff --git a/build/all.gyp b/build/all.gyp
index aa8e369..5fbd8c2 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -22,4 +22,3 @@
}
]
}
-
diff --git a/build/standalone.gypi b/build/standalone.gypi
index 4cb5e00..b1aec36 100644
--- a/build/standalone.gypi
+++ b/build/standalone.gypi
@@ -37,6 +37,7 @@
'visibility%': 'hidden',
'v8_enable_backtrace%': 0,
'v8_enable_i18n_support%': 1,
+ 'v8_deprecation_warnings': 1,
'msvs_multi_core_compile%': '1',
'mac_deployment_target%': '10.5',
'variables': {
diff --git a/include/v8.h b/include/v8.h
index e44c0bf..6e1ac3f 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1736,7 +1736,7 @@
* the function calls 'strlen' to determine the buffer length.
*/
V8_DEPRECATED(
- "Use NewFromOneByte instead",
+ "Use NewFromUtf8 instead",
V8_INLINE static Local<String> New(const char* data, int length = -1));
/** Allocates a new string from 16-bit character codes.*/
@@ -2535,7 +2535,7 @@
/**
* Returns scriptId object.
*/
- V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId()) const;
+ V8_DEPRECATED("Use ScriptId instead", Handle<Value> GetScriptId() const);
/**
* Returns scriptId.
@@ -2899,7 +2899,7 @@
V8_DEPRECATED(
"Use ValueOf instead",
- double NumberValue()) const { return ValueOf(); }
+ double NumberValue() const) { return ValueOf(); }
/**
* A specialization of Value::NumberValue that is more efficient
@@ -2937,7 +2937,7 @@
V8_DEPRECATED(
"Use ValueOf instead",
- double NumberValue()) const { return ValueOf(); }
+ double NumberValue() const) { return ValueOf(); }
/**
* Returns the Number held by the object.
@@ -2960,7 +2960,7 @@
V8_DEPRECATED(
"Use ValueOf instead",
- bool BooleanValue()) const { return ValueOf(); }
+ bool BooleanValue() const) { return ValueOf(); }
/**
* Returns the Boolean held by the object.
@@ -2983,7 +2983,7 @@
V8_DEPRECATED(
"Use ValueOf instead",
- Local<String> StringValue()) const { return ValueOf(); }
+ Local<String> StringValue() const) { return ValueOf(); }
/**
* Returns the String held by the object.
@@ -3008,7 +3008,7 @@
V8_DEPRECATED(
"Use ValueOf instead",
- Local<Symbol> SymbolValue()) const { return ValueOf(); }
+ Local<Symbol> SymbolValue() const) { return ValueOf(); }
/**
* Returns the Symbol held by the object.
@@ -4054,11 +4054,9 @@
*/
void Dispose();
- /**
- * Associate embedder-specific data with the isolate. This legacy method
- * puts the data in the 0th slot. It will be deprecated soon.
- */
- V8_INLINE void SetData(void* data);
+ V8_DEPRECATED("Use SetData(0, data) instead.",
+ V8_INLINE void SetData(void* data));
+ V8_DEPRECATED("Use GetData(0) instead.", V8_INLINE void* GetData());
/**
* Associate embedder-specific data with the isolate. |slot| has to be
@@ -4067,13 +4065,6 @@
V8_INLINE void SetData(uint32_t slot, void* data);
/**
- * Retrieve embedder-specific data from the isolate. This legacy method
- * retrieves the data from slot 0. It will be deprecated soon.
- * Returns NULL if SetData has never been called.
- */
- V8_INLINE void* GetData();
-
- /**
* Retrieve embedder-specific data from the isolate.
* Returns NULL if SetData has never been called for the given |slot|.
*/
@@ -6047,7 +6038,7 @@
void Template::Set(const char* name, v8::Handle<Data> value) {
- Set(v8::String::New(name), value);
+ Set(v8::String::NewFromUtf8(Isolate::GetCurrent(), name), value);
}
diff --git a/samples/lineprocessor.cc b/samples/lineprocessor.cc
index 5068c88..925e148 100644
--- a/samples/lineprocessor.cc
+++ b/samples/lineprocessor.cc
@@ -99,7 +99,7 @@
const char* ToCString(const v8::String::Utf8Value& value);
void ReportException(v8::Isolate* isolate, v8::TryCatch* handler);
-v8::Handle<v8::String> ReadFile(const char* name);
+v8::Handle<v8::String> ReadFile(v8::Isolate* isolate, const char* name);
v8::Handle<v8::String> ReadLine();
void Print(const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -174,14 +174,14 @@
} else if (strncmp(str, "--", 2) == 0) {
printf("Warning: unknown flag %s.\nTry --help for options\n", str);
} else if (strcmp(str, "-e") == 0 && i + 1 < argc) {
- script_source = v8::String::New(argv[i + 1]);
- script_name = v8::String::New("unnamed");
+ script_source = v8::String::NewFromUtf8(isolate, argv[i + 1]);
+ script_name = v8::String::NewFromUtf8(isolate, "unnamed");
i++;
script_param_counter++;
} else {
// Use argument as a name of file to load.
- script_source = ReadFile(str);
- script_name = v8::String::New(str);
+ script_source = ReadFile(isolate, str);
+ script_name = v8::String::NewFromUtf8(isolate, str);
if (script_source.IsEmpty()) {
printf("Error reading '%s'\n", str);
return 1;
@@ -203,11 +203,12 @@
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
// Bind the global 'print' function to the C++ Print callback.
- global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print));
+ global->Set(v8::String::NewFromUtf8(isolate, "print"),
+ v8::FunctionTemplate::New(Print));
if (cycle_type == CycleInJs) {
// Bind the global 'read_line' function to the C++ Print callback.
- global->Set(v8::String::New("read_line"),
+ global->Set(v8::String::NewFromUtf8(isolate, "read_line"),
v8::FunctionTemplate::New(ReadLine));
}
@@ -277,7 +278,8 @@
v8::Locker lock(isolate);
#endif // ENABLE_DEBUGGER_SUPPORT
- v8::Handle<v8::String> fun_name = v8::String::New("ProcessLine");
+ v8::Handle<v8::String> fun_name =
+ v8::String::NewFromUtf8(isolate, "ProcessLine");
v8::Handle<v8::Value> process_val = context->Global()->Get(fun_name);
// If there is no Process function, or if it is not a function,
@@ -338,7 +340,7 @@
// Reads a file into a v8 string.
-v8::Handle<v8::String> ReadFile(const char* name) {
+v8::Handle<v8::String> ReadFile(v8::Isolate* isolate, const char* name) {
FILE* file = fopen(name, "rb");
if (file == NULL) return v8::Handle<v8::String>();
@@ -353,7 +355,8 @@
i += read;
}
fclose(file);
- v8::Handle<v8::String> result = v8::String::New(chars, size);
+ v8::Handle<v8::String> result =
+ v8::String::NewFromUtf8(isolate, chars, v8::String::kNormalString, size);
delete[] chars;
return result;
}
@@ -417,7 +420,8 @@
// function is called. Reads a string from standard input and returns.
void ReadLine(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() > 0) {
- args.GetIsolate()->ThrowException(v8::String::New("Unexpected arguments"));
+ args.GetIsolate()->ThrowException(
+ v8::String::NewFromUtf8(args.GetIsolate(), "Unexpected arguments"));
return;
}
args.GetReturnValue().Set(ReadLine());
@@ -435,8 +439,9 @@
#endif // ENABLE_DEBUGGER_SUPPORT
res = fgets(buffer, kBufferSize, stdin);
}
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
if (res == NULL) {
- v8::Handle<v8::Primitive> t = v8::Undefined(v8::Isolate::GetCurrent());
+ v8::Handle<v8::Primitive> t = v8::Undefined(isolate);
return v8::Handle<v8::String>::Cast(t);
}
// Remove newline char
@@ -446,5 +451,5 @@
break;
}
}
- return v8::String::New(buffer);
+ return v8::String::NewFromUtf8(isolate, buffer);
}
diff --git a/samples/process.cc b/samples/process.cc
index d1d36ca..b18a3ff 100644
--- a/samples/process.cc
+++ b/samples/process.cc
@@ -161,7 +161,8 @@
// Create a template for the global object where we set the
// built-in global functions.
Handle<ObjectTemplate> global = ObjectTemplate::New();
- global->Set(String::New("log"), FunctionTemplate::New(LogCallback));
+ global->Set(String::NewFromUtf8(GetIsolate(), "log"),
+ FunctionTemplate::New(LogCallback));
// Each processor gets its own context so different processors don't
// affect each other. Context::New returns a persistent handle which
@@ -185,7 +186,7 @@
// The script compiled and ran correctly. Now we fetch out the
// Process function from the global object.
- Handle<String> process_name = String::New("Process");
+ Handle<String> process_name = String::NewFromUtf8(GetIsolate(), "Process");
Handle<Value> process_val = context->Global()->Get(process_name);
// If there is no Process function, or if it is not a function,
@@ -244,10 +245,12 @@
v8::Local<v8::Context>::New(GetIsolate(), context_);
// Set the options object as a property on the global object.
- context->Global()->Set(String::New("options"), opts_obj);
+ context->Global()->Set(String::NewFromUtf8(GetIsolate(), "options"),
+ opts_obj);
Handle<Object> output_obj = WrapMap(output);
- context->Global()->Set(String::New("output"), output_obj);
+ context->Global()->Set(String::NewFromUtf8(GetIsolate(), "output"),
+ output_obj);
return true;
}
@@ -291,8 +294,8 @@
// Dispose the persistent handles. When noone else has any
// references to the objects stored in the handles they will be
// automatically reclaimed.
- context_.Dispose();
- process_.Dispose();
+ context_.Reset();
+ process_.Reset();
}
@@ -370,8 +373,9 @@
// Otherwise fetch the value and wrap it in a JavaScript string
const string& value = (*iter).second;
- info.GetReturnValue().Set(
- String::New(value.c_str(), static_cast<int>(value.length())));
+ info.GetReturnValue().Set(String::NewFromUtf8(
+ info.GetIsolate(), value.c_str(), String::kNormalString,
+ static_cast<int>(value.length())));
}
@@ -465,8 +469,9 @@
const string& path = request->Path();
// Wrap the result in a JavaScript string and return it.
- info.GetReturnValue().Set(
- String::New(path.c_str(), static_cast<int>(path.length())));
+ info.GetReturnValue().Set(String::NewFromUtf8(
+ info.GetIsolate(), path.c_str(), String::kNormalString,
+ static_cast<int>(path.length())));
}
@@ -475,8 +480,9 @@
const PropertyCallbackInfo<Value>& info) {
HttpRequest* request = UnwrapRequest(info.Holder());
const string& path = request->Referrer();
- info.GetReturnValue().Set(
- String::New(path.c_str(), static_cast<int>(path.length())));
+ info.GetReturnValue().Set(String::NewFromUtf8(
+ info.GetIsolate(), path.c_str(), String::kNormalString,
+ static_cast<int>(path.length())));
}
@@ -484,8 +490,9 @@
const PropertyCallbackInfo<Value>& info) {
HttpRequest* request = UnwrapRequest(info.Holder());
const string& path = request->Host();
- info.GetReturnValue().Set(
- String::New(path.c_str(), static_cast<int>(path.length())));
+ info.GetReturnValue().Set(String::NewFromUtf8(
+ info.GetIsolate(), path.c_str(), String::kNormalString,
+ static_cast<int>(path.length())));
}
@@ -494,8 +501,9 @@
const PropertyCallbackInfo<Value>& info) {
HttpRequest* request = UnwrapRequest(info.Holder());
const string& path = request->UserAgent();
- info.GetReturnValue().Set(
- String::New(path.c_str(), static_cast<int>(path.length())));
+ info.GetReturnValue().Set(String::NewFromUtf8(
+ info.GetIsolate(), path.c_str(), String::kNormalString,
+ static_cast<int>(path.length())));
}
@@ -507,10 +515,18 @@
result->SetInternalFieldCount(1);
// Add accessors for each of the fields of the request.
- result->SetAccessor(String::NewSymbol("path"), GetPath);
- result->SetAccessor(String::NewSymbol("referrer"), GetReferrer);
- result->SetAccessor(String::NewSymbol("host"), GetHost);
- result->SetAccessor(String::NewSymbol("userAgent"), GetUserAgent);
+ result->SetAccessor(
+ String::NewFromUtf8(isolate, "path", String::kInternalizedString),
+ GetPath);
+ result->SetAccessor(
+ String::NewFromUtf8(isolate, "referrer", String::kInternalizedString),
+ GetReferrer);
+ result->SetAccessor(
+ String::NewFromUtf8(isolate, "host", String::kInternalizedString),
+ GetHost);
+ result->SetAccessor(
+ String::NewFromUtf8(isolate, "userAgent", String::kInternalizedString),
+ GetUserAgent);
// Again, return the result through the current handle scope.
return handle_scope.Close(result);
@@ -575,7 +591,7 @@
// Reads a file into a v8 string.
-Handle<String> ReadFile(const string& name) {
+Handle<String> ReadFile(Isolate* isolate, const string& name) {
FILE* file = fopen(name.c_str(), "rb");
if (file == NULL) return Handle<String>();
@@ -590,7 +606,8 @@
i += read;
}
fclose(file);
- Handle<String> result = String::New(chars, size);
+ Handle<String> result =
+ String::NewFromUtf8(isolate, chars, String::kNormalString, size);
delete[] chars;
return result;
}
@@ -636,7 +653,7 @@
}
Isolate* isolate = Isolate::GetCurrent();
HandleScope scope(isolate);
- Handle<String> source = ReadFile(file);
+ Handle<String> source = ReadFile(isolate, file);
if (source.IsEmpty()) {
fprintf(stderr, "Error reading '%s'.\n", file.c_str());
return 1;
diff --git a/samples/shell.cc b/samples/shell.cc
index 06bd8f6..f651850 100644
--- a/samples/shell.cc
+++ b/samples/shell.cc
@@ -58,7 +58,7 @@
void Load(const v8::FunctionCallbackInfo<v8::Value>& args);
void Quit(const v8::FunctionCallbackInfo<v8::Value>& args);
void Version(const v8::FunctionCallbackInfo<v8::Value>& args);
-v8::Handle<v8::String> ReadFile(const char* name);
+v8::Handle<v8::String> ReadFile(v8::Isolate* isolate, const char* name);
void ReportException(v8::Isolate* isolate, v8::TryCatch* handler);
@@ -100,15 +100,20 @@
// Create a template for the global object.
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
// Bind the global 'print' function to the C++ Print callback.
- global->Set(v8::String::New("print"), v8::FunctionTemplate::New(Print));
+ global->Set(v8::String::NewFromUtf8(isolate, "print"),
+ v8::FunctionTemplate::New(Print));
// Bind the global 'read' function to the C++ Read callback.
- global->Set(v8::String::New("read"), v8::FunctionTemplate::New(Read));
+ global->Set(v8::String::NewFromUtf8(isolate, "read"),
+ v8::FunctionTemplate::New(Read));
// Bind the global 'load' function to the C++ Load callback.
- global->Set(v8::String::New("load"), v8::FunctionTemplate::New(Load));
+ global->Set(v8::String::NewFromUtf8(isolate, "load"),
+ v8::FunctionTemplate::New(Load));
// Bind the 'quit' function
- global->Set(v8::String::New("quit"), v8::FunctionTemplate::New(Quit));
+ global->Set(v8::String::NewFromUtf8(isolate, "quit"),
+ v8::FunctionTemplate::New(Quit));
// Bind the 'version' function
- global->Set(v8::String::New("version"), v8::FunctionTemplate::New(Version));
+ global->Set(v8::String::NewFromUtf8(isolate, "version"),
+ v8::FunctionTemplate::New(Version));
return v8::Context::New(isolate, NULL, global);
}
@@ -141,19 +146,19 @@
void Read(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1) {
args.GetIsolate()->ThrowException(
- v8::String::New("Bad parameters"));
+ v8::String::NewFromUtf8(args.GetIsolate(), "Bad parameters"));
return;
}
v8::String::Utf8Value file(args[0]);
if (*file == NULL) {
args.GetIsolate()->ThrowException(
- v8::String::New("Error loading file"));
+ v8::String::NewFromUtf8(args.GetIsolate(), "Error loading file"));
return;
}
- v8::Handle<v8::String> source = ReadFile(*file);
+ v8::Handle<v8::String> source = ReadFile(args.GetIsolate(), *file);
if (source.IsEmpty()) {
args.GetIsolate()->ThrowException(
- v8::String::New("Error loading file"));
+ v8::String::NewFromUtf8(args.GetIsolate(), "Error loading file"));
return;
}
args.GetReturnValue().Set(source);
@@ -169,22 +174,22 @@
v8::String::Utf8Value file(args[i]);
if (*file == NULL) {
args.GetIsolate()->ThrowException(
- v8::String::New("Error loading file"));
+ v8::String::NewFromUtf8(args.GetIsolate(), "Error loading file"));
return;
}
- v8::Handle<v8::String> source = ReadFile(*file);
+ v8::Handle<v8::String> source = ReadFile(args.GetIsolate(), *file);
if (source.IsEmpty()) {
args.GetIsolate()->ThrowException(
- v8::String::New("Error loading file"));
+ v8::String::NewFromUtf8(args.GetIsolate(), "Error loading file"));
return;
}
if (!ExecuteString(args.GetIsolate(),
source,
- v8::String::New(*file),
+ v8::String::NewFromUtf8(args.GetIsolate(), *file),
false,
false)) {
args.GetIsolate()->ThrowException(
- v8::String::New("Error executing file"));
+ v8::String::NewFromUtf8(args.GetIsolate(), "Error executing file"));
return;
}
}
@@ -204,12 +209,13 @@
void Version(const v8::FunctionCallbackInfo<v8::Value>& args) {
- args.GetReturnValue().Set(v8::String::New(v8::V8::GetVersion()));
+ args.GetReturnValue().Set(
+ v8::String::NewFromUtf8(args.GetIsolate(), v8::V8::GetVersion()));
}
// Reads a file into a v8 string.
-v8::Handle<v8::String> ReadFile(const char* name) {
+v8::Handle<v8::String> ReadFile(v8::Isolate* isolate, const char* name) {
FILE* file = fopen(name, "rb");
if (file == NULL) return v8::Handle<v8::String>();
@@ -224,7 +230,8 @@
i += read;
}
fclose(file);
- v8::Handle<v8::String> result = v8::String::New(chars, size);
+ v8::Handle<v8::String> result =
+ v8::String::NewFromUtf8(isolate, chars, v8::String::kNormalString, size);
delete[] chars;
return result;
}
@@ -245,13 +252,15 @@
"Warning: unknown flag %s.\nTry --help for options\n", str);
} else if (strcmp(str, "-e") == 0 && i + 1 < argc) {
// Execute argument given to -e option directly.
- v8::Handle<v8::String> file_name = v8::String::New("unnamed");
- v8::Handle<v8::String> source = v8::String::New(argv[++i]);
+ v8::Handle<v8::String> file_name =
+ v8::String::NewFromUtf8(isolate, "unnamed");
+ v8::Handle<v8::String> source =
+ v8::String::NewFromUtf8(isolate, argv[++i]);
if (!ExecuteString(isolate, source, file_name, false, true)) return 1;
} else {
// Use all other arguments as names of files to load and run.
- v8::Handle<v8::String> file_name = v8::String::New(str);
- v8::Handle<v8::String> source = ReadFile(str);
+ v8::Handle<v8::String> file_name = v8::String::NewFromUtf8(isolate, str);
+ v8::Handle<v8::String> source = ReadFile(isolate, str);
if (source.IsEmpty()) {
fprintf(stderr, "Error reading '%s'\n", str);
continue;
@@ -269,7 +278,8 @@
static const int kBufferSize = 256;
// Enter the execution environment before evaluating any code.
v8::Context::Scope context_scope(context);
- v8::Local<v8::String> name(v8::String::New("(shell)"));
+ v8::Local<v8::String> name(
+ v8::String::NewFromUtf8(context->GetIsolate(), "(shell)"));
while (true) {
char buffer[kBufferSize];
fprintf(stderr, "> ");
@@ -277,7 +287,7 @@
if (str == NULL) break;
v8::HandleScope handle_scope(context->GetIsolate());
ExecuteString(context->GetIsolate(),
- v8::String::New(str),
+ v8::String::NewFromUtf8(context->GetIsolate(), str),
name,
true,
true);
diff --git a/src/allocation-tracker.cc b/src/allocation-tracker.cc
index 586ce3c..28883ae 100644
--- a/src/allocation-tracker.cc
+++ b/src/allocation-tracker.cc
@@ -272,7 +272,7 @@
void* data) {
UnresolvedLocation* location = reinterpret_cast<UnresolvedLocation*>(data);
location->script_ = Handle<Script>::null();
- obj->Dispose();
+ obj->Reset();
}
diff --git a/src/allocation-tracker.h b/src/allocation-tracker.h
index 617cf90..8791b51 100644
--- a/src/allocation-tracker.h
+++ b/src/allocation-tracker.h
@@ -135,4 +135,3 @@
} } // namespace v8::internal
#endif // V8_ALLOCATION_TRACKER_H_
-
diff --git a/src/api.cc b/src/api.cc
index adc3e7a..18aca94 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3401,13 +3401,14 @@
Local<String> v8::Object::ObjectProtoToString() {
- i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
- ON_BAILOUT(isolate, "v8::Object::ObjectProtoToString()",
+ i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
+ Isolate* isolate = reinterpret_cast<Isolate*>(i_isolate);
+ ON_BAILOUT(i_isolate, "v8::Object::ObjectProtoToString()",
return Local<v8::String>());
- ENTER_V8(isolate);
+ ENTER_V8(i_isolate);
i::Handle<i::JSObject> self = Utils::OpenHandle(this);
- i::Handle<i::Object> name(self->class_name(), isolate);
+ i::Handle<i::Object> name(self->class_name(), i_isolate);
// Native implementation of Object.prototype.toString (v8natives.js):
// var c = %_ClassOf(this);
@@ -3415,13 +3416,11 @@
// return "[object " + c + "]";
if (!name->IsString()) {
- return v8::String::New("[object ]");
-
+ return v8::String::NewFromUtf8(isolate, "[object ]");
} else {
i::Handle<i::String> class_name = i::Handle<i::String>::cast(name);
if (class_name->IsOneByteEqualTo(STATIC_ASCII_VECTOR("Arguments"))) {
- return v8::String::New("[object Object]");
-
+ return v8::String::NewFromUtf8(isolate, "[object Object]");
} else {
const char* prefix = "[object ";
Local<String> str = Utils::ToLocal(class_name);
@@ -3447,7 +3446,8 @@
i::OS::MemCopy(ptr, postfix, postfix_len * v8::internal::kCharSize);
// Copy the buffer into a heap-allocated string and return it.
- Local<String> result = v8::String::New(buf.start(), buf_len);
+ Local<String> result = v8::String::NewFromUtf8(
+ isolate, buf.start(), String::kNormalString, buf_len);
return result;
}
}
diff --git a/src/arguments.cc b/src/arguments.cc
index 3a4d733..ae06bd0 100644
--- a/src/arguments.cc
+++ b/src/arguments.cc
@@ -117,4 +117,11 @@
#undef WRITE_CALL_2_VOID
+double ClobberDoubleRegisters(double x1, double x2, double x3, double x4) {
+ // TODO(ulan): This clobbers only subset of registers depending on compiler,
+ // Rewrite this in assembly to really clobber all registers.
+ return x1 * 1.01 + x2 * 2.02 + x3 * 3.03 + x4 * 4.04;
+}
+
+
} } // namespace v8::internal
diff --git a/src/arguments.h b/src/arguments.h
index 92e5740..b7137c3 100644
--- a/src/arguments.h
+++ b/src/arguments.h
@@ -289,12 +289,23 @@
};
+double ClobberDoubleRegisters(double x1, double x2, double x3, double x4);
+
+
+#ifdef DEBUG
+#define CLOBBER_DOUBLE_REGISTERS() ClobberDoubleRegisters(1, 2, 3, 4);
+#else
+#define CLOBBER_DOUBLE_REGISTERS()
+#endif
+
+
#define DECLARE_RUNTIME_FUNCTION(Type, Name) \
Type Name(int args_length, Object** args_object, Isolate* isolate)
#define RUNTIME_FUNCTION(Type, Name) \
static Type __RT_impl_##Name(Arguments args, Isolate* isolate); \
Type Name(int args_length, Object** args_object, Isolate* isolate) { \
+ CLOBBER_DOUBLE_REGISTERS(); \
Arguments args(args_length, args_object); \
return __RT_impl_##Name(args, isolate); \
} \
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
index 19fa9f2..7ae2924 100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -857,7 +857,8 @@
}
-void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
+static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
+ SaveFPRegsMode save_doubles) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -866,7 +867,7 @@
// registers.
__ stm(db_w, sp, kJSCallerSaved | kCalleeSaved);
// Pass the function and deoptimization type to the runtime system.
- __ CallRuntime(Runtime::kNotifyStubFailure, 0);
+ __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles);
__ ldm(ia_w, sp, kJSCallerSaved | kCalleeSaved);
}
@@ -875,6 +876,16 @@
}
+void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
+ Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
+}
+
+
+void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
+ Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
+}
+
+
static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
Deoptimizer::BailoutType type) {
{
diff --git a/src/arm/deoptimizer-arm.cc b/src/arm/deoptimizer-arm.cc
index c846f98..6031499 100644
--- a/src/arm/deoptimizer-arm.cc
+++ b/src/arm/deoptimizer-arm.cc
@@ -127,6 +127,11 @@
}
+Code* Deoptimizer::NotifyStubFailureBuiltin() {
+ return isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles);
+}
+
+
#define __ masm()->
// This code tries to be close to ia32 code so that any changes can be
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc
index 64a9fdf..4a39970 100644
--- a/src/arm/full-codegen-arm.cc
+++ b/src/arm/full-codegen-arm.cc
@@ -3347,50 +3347,6 @@
}
-void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
- ASSERT(expr->arguments()->length() == 0);
- Label slow_allocate_heapnumber;
- Label heapnumber_allocated;
-
- __ LoadRoot(r6, Heap::kHeapNumberMapRootIndex);
- __ AllocateHeapNumber(r4, r1, r2, r6, &slow_allocate_heapnumber);
- __ jmp(&heapnumber_allocated);
-
- __ bind(&slow_allocate_heapnumber);
- // Allocate a heap number.
- __ CallRuntime(Runtime::kNumberAlloc, 0);
- __ mov(r4, Operand(r0));
-
- __ bind(&heapnumber_allocated);
-
- // Convert 32 random bits in r0 to 0.(32 random bits) in a double
- // by computing:
- // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
- __ PrepareCallCFunction(1, r0);
- __ ldr(r0,
- ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX));
- __ ldr(r0, FieldMemOperand(r0, GlobalObject::kNativeContextOffset));
- __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
-
- // 0x41300000 is the top half of 1.0 x 2^20 as a double.
- // Create this constant using mov/orr to avoid PC relative load.
- __ mov(r1, Operand(0x41000000));
- __ orr(r1, r1, Operand(0x300000));
- // Move 0x41300000xxxxxxxx (x = random bits) to VFP.
- __ vmov(d7, r0, r1);
- // Move 0x4130000000000000 to VFP.
- __ mov(r0, Operand::Zero());
- __ vmov(d8, r0, r1);
- // Subtract and store the result in the heap number.
- __ vsub(d7, d7, d8);
- __ sub(r0, r4, Operand(kHeapObjectTag));
- __ vstr(d7, r0, HeapNumber::kValueOffset);
- __ mov(r0, r4);
-
- context()->Plug(r0);
-}
-
-
void FullCodeGenerator::EmitSubString(CallRuntime* expr) {
// Load the arguments on the stack and call the stub.
SubStringStub stub;
diff --git a/src/arm/lithium-arm.cc b/src/arm/lithium-arm.cc
index a1e892b..eeffc16 100644
--- a/src/arm/lithium-arm.cc
+++ b/src/arm/lithium-arm.cc
@@ -1720,19 +1720,6 @@
}
-LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
- ASSERT(instr->representation().IsDouble());
- ASSERT(instr->global_object()->representation().IsTagged());
- LOperand* global_object = UseTempRegister(instr->global_object());
- LOperand* scratch = TempRegister();
- LOperand* scratch2 = TempRegister();
- LOperand* scratch3 = TempRegister();
- LRandom* result = new(zone()) LRandom(
- global_object, scratch, scratch2, scratch3);
- return DefineFixedDouble(result, d7);
-}
-
-
LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
ASSERT(instr->left()->representation().IsTagged());
ASSERT(instr->right()->representation().IsTagged());
diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h
index 5b9278b..72932de 100644
--- a/src/arm/lithium-arm.h
+++ b/src/arm/lithium-arm.h
@@ -155,7 +155,6 @@
V(Parameter) \
V(Power) \
V(PushArgument) \
- V(Random) \
V(RegExpLiteral) \
V(Return) \
V(SeqStringGetChar) \
@@ -1481,28 +1480,6 @@
};
-class LRandom V8_FINAL : public LTemplateInstruction<1, 1, 3> {
- public:
- LRandom(LOperand* global_object,
- LOperand* scratch,
- LOperand* scratch2,
- LOperand* scratch3) {
- inputs_[0] = global_object;
- temps_[0] = scratch;
- temps_[1] = scratch2;
- temps_[2] = scratch3;
- }
-
- LOperand* global_object() const { return inputs_[0]; }
- LOperand* scratch() const { return temps_[0]; }
- LOperand* scratch2() const { return temps_[1]; }
- LOperand* scratch3() const { return temps_[2]; }
-
- DECLARE_CONCRETE_INSTRUCTION(Random, "random")
- DECLARE_HYDROGEN_ACCESSOR(Random)
-};
-
-
class LArithmeticD V8_FINAL : public LTemplateInstruction<1, 2, 0> {
public:
LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index 0aa8197..4b05db1 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -98,6 +98,38 @@
}
+void LCodeGen::SaveCallerDoubles() {
+ ASSERT(info()->saves_caller_doubles());
+ ASSERT(NeedsEagerFrame());
+ Comment(";;; Save clobbered callee double registers");
+ int count = 0;
+ BitVector* doubles = chunk()->allocated_double_registers();
+ BitVector::Iterator save_iterator(doubles);
+ while (!save_iterator.Done()) {
+ __ vstr(DwVfpRegister::FromAllocationIndex(save_iterator.Current()),
+ MemOperand(sp, count * kDoubleSize));
+ save_iterator.Advance();
+ count++;
+ }
+}
+
+
+void LCodeGen::RestoreCallerDoubles() {
+ ASSERT(info()->saves_caller_doubles());
+ ASSERT(NeedsEagerFrame());
+ Comment(";;; Restore clobbered callee double registers");
+ BitVector* doubles = chunk()->allocated_double_registers();
+ BitVector::Iterator save_iterator(doubles);
+ int count = 0;
+ while (!save_iterator.Done()) {
+ __ vldr(DwVfpRegister::FromAllocationIndex(save_iterator.Current()),
+ MemOperand(sp, count * kDoubleSize));
+ save_iterator.Advance();
+ count++;
+ }
+}
+
+
bool LCodeGen::GeneratePrologue() {
ASSERT(is_generating());
@@ -158,16 +190,7 @@
}
if (info()->saves_caller_doubles()) {
- Comment(";;; Save clobbered callee double registers");
- int count = 0;
- BitVector* doubles = chunk()->allocated_double_registers();
- BitVector::Iterator save_iterator(doubles);
- while (!save_iterator.Done()) {
- __ vstr(DwVfpRegister::FromAllocationIndex(save_iterator.Current()),
- MemOperand(sp, count * kDoubleSize));
- save_iterator.Advance();
- count++;
- }
+ SaveCallerDoubles();
}
// Possibly allocate a local context.
@@ -313,6 +336,7 @@
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
}
if (deopt_jump_table_[i].needs_frame) {
+ ASSERT(!info()->saves_caller_doubles());
__ mov(ip, Operand(ExternalReference::ForDeoptEntry(entry)));
if (needs_frame.is_bound()) {
__ b(&needs_frame);
@@ -330,6 +354,10 @@
__ mov(pc, ip);
}
} else {
+ if (info()->saves_caller_doubles()) {
+ ASSERT(info()->IsStub());
+ RestoreCallerDoubles();
+ }
__ mov(lr, Operand(pc), LeaveCC, al);
__ mov(pc, Operand(ExternalReference::ForDeoptEntry(entry)));
}
@@ -828,7 +856,10 @@
}
ASSERT(info()->IsStub() || frame_is_built_);
- if (condition == al && frame_is_built_) {
+ // Go through jump table if we need to handle condition, build frame, or
+ // restore caller doubles.
+ if (condition == al && frame_is_built_ &&
+ !info()->saves_caller_doubles()) {
__ Call(entry, RelocInfo::RUNTIME_ENTRY);
} else {
// We often have several deopts to the same entry, reuse the last
@@ -2929,16 +2960,7 @@
__ CallRuntime(Runtime::kTraceExit, 1);
}
if (info()->saves_caller_doubles()) {
- ASSERT(NeedsEagerFrame());
- BitVector* doubles = chunk()->allocated_double_registers();
- BitVector::Iterator save_iterator(doubles);
- int count = 0;
- while (!save_iterator.Done()) {
- __ vldr(DwVfpRegister::FromAllocationIndex(save_iterator.Current()),
- MemOperand(sp, count * kDoubleSize));
- save_iterator.Advance();
- count++;
- }
+ RestoreCallerDoubles();
}
int no_frame_start = -1;
if (NeedsEagerFrame()) {
@@ -3934,68 +3956,6 @@
}
-void LCodeGen::DoRandom(LRandom* instr) {
- // Assert that the register size is indeed the size of each seed.
- static const int kSeedSize = sizeof(uint32_t);
- STATIC_ASSERT(kPointerSize == kSeedSize);
-
- // Load native context
- Register global_object = ToRegister(instr->global_object());
- Register native_context = global_object;
- __ ldr(native_context, FieldMemOperand(
- global_object, GlobalObject::kNativeContextOffset));
-
- // Load state (FixedArray of the native context's random seeds)
- static const int kRandomSeedOffset =
- FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize;
- Register state = native_context;
- __ ldr(state, FieldMemOperand(native_context, kRandomSeedOffset));
-
- // Load state[0].
- Register state0 = ToRegister(instr->scratch());
- __ ldr(state0, FieldMemOperand(state, ByteArray::kHeaderSize));
- // Load state[1].
- Register state1 = ToRegister(instr->scratch2());
- __ ldr(state1, FieldMemOperand(state, ByteArray::kHeaderSize + kSeedSize));
-
- // state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16)
- Register scratch3 = ToRegister(instr->scratch3());
- Register scratch4 = scratch0();
- __ and_(scratch3, state0, Operand(0xFFFF));
- __ mov(scratch4, Operand(18273));
- __ mul(scratch3, scratch3, scratch4);
- __ add(state0, scratch3, Operand(state0, LSR, 16));
- // Save state[0].
- __ str(state0, FieldMemOperand(state, ByteArray::kHeaderSize));
-
- // state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16)
- __ and_(scratch3, state1, Operand(0xFFFF));
- __ mov(scratch4, Operand(36969));
- __ mul(scratch3, scratch3, scratch4);
- __ add(state1, scratch3, Operand(state1, LSR, 16));
- // Save state[1].
- __ str(state1, FieldMemOperand(state, ByteArray::kHeaderSize + kSeedSize));
-
- // Random bit pattern = (state[0] << 14) + (state[1] & 0x3FFFF)
- Register random = scratch4;
- __ and_(random, state1, Operand(0x3FFFF));
- __ add(random, random, Operand(state0, LSL, 14));
-
- // 0x41300000 is the top half of 1.0 x 2^20 as a double.
- // Create this constant using mov/orr to avoid PC relative load.
- __ mov(scratch3, Operand(0x41000000));
- __ orr(scratch3, scratch3, Operand(0x300000));
- // Move 0x41300000xxxxxxxx (x = random bits) to VFP.
- DwVfpRegister result = ToDoubleRegister(instr->result());
- __ vmov(result, random, scratch3);
- // Move 0x4130000000000000 to VFP.
- __ mov(scratch4, Operand::Zero());
- DwVfpRegister scratch5 = double_scratch0();
- __ vmov(scratch5, scratch4, scratch3);
- __ vsub(result, result, scratch5);
-}
-
-
void LCodeGen::DoMathExp(LMathExp* instr) {
DwVfpRegister input = ToDoubleRegister(instr->value());
DwVfpRegister result = ToDoubleRegister(instr->result());
diff --git a/src/arm/lithium-codegen-arm.h b/src/arm/lithium-codegen-arm.h
index 7390a48..3f2ba35 100644
--- a/src/arm/lithium-codegen-arm.h
+++ b/src/arm/lithium-codegen-arm.h
@@ -186,6 +186,9 @@
void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); }
+ void SaveCallerDoubles();
+ void RestoreCallerDoubles();
+
// Code generation passes. Returns true if code generation should
// continue.
bool GeneratePrologue();
diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
index 47d42a3..65962e7 100644
--- a/src/arm/macro-assembler-arm.cc
+++ b/src/arm/macro-assembler-arm.cc
@@ -516,6 +516,12 @@
Check(eq, kWrongAddressOrValuePassedToRecordWrite);
}
+ // Count number of write barriers in generated code.
+ isolate()->counters()->write_barriers_static()->Increment();
+ // TODO(mstarzinger): Dynamic counter missing.
+
+ // First, check if a write barrier is even needed. The tests below
+ // catch stores of smis and stores into the young generation.
Label done;
if (smi_check == INLINE_SMI_CHECK) {
diff --git a/src/arm/macro-assembler-arm.h b/src/arm/macro-assembler-arm.h
index 4897064..5e20eec 100644
--- a/src/arm/macro-assembler-arm.h
+++ b/src/arm/macro-assembler-arm.h
@@ -1054,8 +1054,10 @@
}
// Convenience function: Same as above, but takes the fid instead.
- void CallRuntime(Runtime::FunctionId id, int num_arguments) {
- CallRuntime(Runtime::FunctionForId(id), num_arguments);
+ void CallRuntime(Runtime::FunctionId id,
+ int num_arguments,
+ SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
+ CallRuntime(Runtime::FunctionForId(id), num_arguments, save_doubles);
}
// Convenience function: call an external reference.
diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc
index 7e82fd0..9b2ba53 100644
--- a/src/arm/stub-cache-arm.cc
+++ b/src/arm/stub-cache-arm.cc
@@ -1038,9 +1038,10 @@
Label miss_cleanup;
Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label;
Register holder =
- stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
- scratch1, scratch2, scratch3,
- name, depth1, miss);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(object, masm->isolate()), receiver,
+ interceptor_holder, scratch1, scratch2, scratch3,
+ name, depth1, miss);
// Invoke an interceptor and if it provides a value,
// branch to |regular_invoke|.
@@ -1054,10 +1055,10 @@
// Check that the maps from interceptor's holder to constant function's
// holder haven't changed and thus we can use cached constant function.
if (*interceptor_holder != lookup->holder()) {
- stub_compiler_->CheckPrototypes(interceptor_holder, receiver,
- Handle<JSObject>(lookup->holder()),
- scratch1, scratch2, scratch3,
- name, depth2, miss);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(interceptor_holder, masm->isolate()), receiver,
+ handle(lookup->holder()), scratch1, scratch2, scratch3,
+ name, depth2, miss);
} else {
// CheckPrototypes has a side effect of fetching a 'holder'
// for API (object which is instanceof for the signature). It's
@@ -1104,9 +1105,9 @@
Handle<JSObject> interceptor_holder,
Label* miss_label) {
Register holder =
- stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
- scratch1, scratch2, scratch3,
- name, miss_label);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(object, masm->isolate()), receiver,
+ interceptor_holder, scratch1, scratch2, scratch3, name, miss_label);
// Call a runtime function to load the interceptor property.
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -1152,26 +1153,6 @@
};
-void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
- Handle<JSObject> object,
- Handle<JSObject> holder,
- Handle<Name> name,
- Register scratch,
- Label* miss) {
- Handle<JSObject> current = object;
- while (!current.is_identical_to(holder)) {
- if (current->IsJSGlobalObject()) {
- GenerateCheckPropertyCell(masm,
- Handle<JSGlobalObject>::cast(current),
- name,
- scratch,
- miss);
- }
- current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
- }
-}
-
-
void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
__ Jump(code, RelocInfo::CODE_TARGET);
}
@@ -1181,7 +1162,7 @@
#define __ ACCESS_MASM(masm())
-Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
+Register StubCompiler::CheckPrototypes(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
@@ -1191,11 +1172,11 @@
int save_at_depth,
Label* miss,
PrototypeCheckType check) {
+ Handle<Map> receiver_map(IC::TypeToMap(*type, isolate()));
// Make sure that the type feedback oracle harvests the receiver map.
// TODO(svenpanne) Remove this hack when all ICs are reworked.
- __ mov(scratch1, Operand(Handle<Map>(object->map())));
+ __ mov(scratch1, Operand(receiver_map));
- Handle<JSObject> first = object;
// Make sure there's no overlap between holder and object registers.
ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg)
@@ -1210,25 +1191,31 @@
__ str(reg, MemOperand(sp, FCA::kHolderIndex * kPointerSize));
}
- // Check the maps in the prototype chain.
- // Traverse the prototype chain from the object and do map checks.
- Handle<JSObject> current = object;
- while (!current.is_identical_to(holder)) {
+ Handle<JSObject> current = Handle<JSObject>::null();
+ if (type->IsConstant()) current = Handle<JSObject>::cast(type->AsConstant());
+ Handle<JSObject> prototype = Handle<JSObject>::null();
+ Handle<Map> current_map = receiver_map;
+ Handle<Map> holder_map(holder->map());
+ // Traverse the prototype chain and check the maps in the prototype chain for
+ // fast and global objects or do negative lookup for normal objects.
+ while (!current_map.is_identical_to(holder_map)) {
++depth;
// Only global objects and objects that do not require access
// checks are allowed in stubs.
- ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
+ ASSERT(current_map->IsJSGlobalProxyMap() ||
+ !current_map->is_access_check_needed());
- Handle<JSObject> prototype(JSObject::cast(current->GetPrototype()));
- if (!current->HasFastProperties() &&
- !current->IsJSGlobalObject() &&
- !current->IsJSGlobalProxy()) {
+ prototype = handle(JSObject::cast(current_map->prototype()));
+ if (current_map->is_dictionary_map() &&
+ !current_map->IsJSGlobalObjectMap() &&
+ !current_map->IsJSGlobalProxyMap()) {
if (!name->IsUniqueName()) {
ASSERT(name->IsString());
name = factory()->InternalizeString(Handle<String>::cast(name));
}
- ASSERT(current->property_dictionary()->FindEntry(*name) ==
+ ASSERT(current.is_null() ||
+ current->property_dictionary()->FindEntry(*name) ==
NameDictionary::kNotFound);
GenerateDictionaryNegativeLookup(masm(), miss, reg, name,
@@ -1239,8 +1226,7 @@
__ ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
} else {
Register map_reg = scratch1;
- if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) {
- Handle<Map> current_map(current->map());
+ if (depth != 1 || check == CHECK_ALL_MAPS) {
// CheckMap implicitly loads the map of |reg| into |map_reg|.
__ CheckMap(reg, map_reg, current_map, miss, DONT_DO_SMI_CHECK);
} else {
@@ -1250,9 +1236,14 @@
// Check access rights to the global object. This has to happen after
// the map check so that we know that the object is actually a global
// object.
- if (current->IsJSGlobalProxy()) {
+ if (current_map->IsJSGlobalProxyMap()) {
__ CheckAccessGlobalProxy(reg, scratch2, miss);
+ } else if (current_map->IsJSGlobalObjectMap()) {
+ GenerateCheckPropertyCell(
+ masm(), Handle<JSGlobalObject>::cast(current), name,
+ scratch2, miss);
}
+
reg = holder_reg; // From now on the object will be in holder_reg.
if (heap()->InNewSpace(*prototype)) {
@@ -1271,28 +1262,24 @@
// Go to the next object in the prototype chain.
current = prototype;
+ current_map = handle(current->map());
}
// Log the check depth.
LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
- if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) {
+ if (depth != 0 || check == CHECK_ALL_MAPS) {
// Check the holder map.
- __ CheckMap(reg, scratch1, Handle<Map>(holder->map()), miss,
- DONT_DO_SMI_CHECK);
+ __ CheckMap(reg, scratch1, current_map, miss, DONT_DO_SMI_CHECK);
}
// Perform security check for access to the global object.
- ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
- if (holder->IsJSGlobalProxy()) {
+ ASSERT(current_map->IsJSGlobalProxyMap() ||
+ !current_map->is_access_check_needed());
+ if (current_map->IsJSGlobalProxyMap()) {
__ CheckAccessGlobalProxy(reg, scratch1, miss);
}
- // If we've skipped any global objects, it's not enough to verify that
- // their maps haven't changed. We also need to check that the property
- // cell for the property is still empty.
- GenerateCheckPropertyCells(masm(), object, holder, name, scratch1, miss);
-
// Return the register containing the holder.
return reg;
}
@@ -1321,14 +1308,14 @@
Register LoadStubCompiler::CallbackHandlerFrontend(
- Handle<Object> object,
+ Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
- Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
+ Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
ASSERT(!reg.is(scratch2()));
@@ -1576,7 +1563,8 @@
// Check that the maps haven't changed.
__ JumpIfSmi(r0, miss);
- CheckPrototypes(object, r0, holder, r3, r1, r4, name, miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()), r0, holder, r3, r1, r4, name, miss);
}
@@ -1639,7 +1627,9 @@
__ JumpIfSmi(r0, &miss);
// Do the right check and compute the holder register.
- Register reg = CheckPrototypes(object, r0, holder, r1, r3, r4, name, &miss);
+ Register reg = CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ r0, holder, r1, r3, r4, name, &miss);
GenerateFastPropertyLoad(masm(), r1, reg, index.is_inobject(holder),
index.translate(holder), Representation::Tagged());
@@ -1675,8 +1665,9 @@
__ JumpIfSmi(receiver, &miss);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, r3, r0,
- r4, name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()), receiver, holder,
+ r3, r0, r4, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -1736,8 +1727,9 @@
__ JumpIfSmi(receiver, &miss);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, r3, r0, r4,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()), receiver, holder,
+ r3, r0, r4, name, &miss);
if (argc == 0) {
// Nothing to do, just return the length.
@@ -1994,8 +1986,8 @@
__ JumpIfSmi(receiver, &miss);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, elements,
- r4, r0, name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), receiver, holder,
+ elements, r4, r0, name, &miss);
// Get the elements array of the object.
__ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset));
@@ -2084,8 +2076,9 @@
r0,
&miss);
ASSERT(!object.is_identical_to(holder));
+ Handle<JSObject> prototype(JSObject::cast(object->GetPrototype(isolate())));
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
r0, holder, r1, r3, r4, name, &miss);
Register receiver = r1;
@@ -2166,8 +2159,9 @@
r0,
&miss);
ASSERT(!object.is_identical_to(holder));
+ Handle<JSObject> prototype(JSObject::cast(object->GetPrototype(isolate())));
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
r0, holder, r1, r3, r4, name, &miss);
Register receiver = r0;
@@ -2243,8 +2237,9 @@
__ JumpIfSmi(r1, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), r1, holder, r0, r3, r4,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ r1, holder, r0, r3, r4, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2313,8 +2308,9 @@
if (cell.is_null()) {
__ ldr(r1, MemOperand(sp, 1 * kPointerSize));
__ JumpIfSmi(r1, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), r1, holder, r0, r3, r4,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ r1, holder, r0, r3, r4, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2421,8 +2417,9 @@
if (cell.is_null()) {
__ ldr(r1, MemOperand(sp, 1 * kPointerSize));
__ JumpIfSmi(r1, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), r1, holder, r0, r3, r4,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ r1, holder, r0, r3, r4, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2530,8 +2527,9 @@
ReserveSpaceForFastApiCall(masm(), r0);
// Check that the maps haven't changed and find a Holder as a side effect.
- CheckPrototypes(Handle<JSObject>::cast(object), r1, holder, r0, r3, r4, name,
- depth, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ r1, holder, r0, r3, r4, name, depth, &miss);
GenerateFastApiDirectCall(masm(), optimization, argc, false);
@@ -2587,8 +2585,9 @@
__ IncrementCounter(isolate()->counters()->call_const(), 1, r0, r3);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), r1, holder, r0, r3, r4,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ r1, holder, r0, r3, r4, name, &miss);
// Patch the receiver on the stack with the global proxy if
// necessary.
@@ -2598,30 +2597,32 @@
}
break;
- case STRING_CHECK:
+ case STRING_CHECK: {
// Check that the object is a string.
__ CompareObjectType(r1, r3, r3, FIRST_NONSTRING_TYPE);
__ b(ge, &miss);
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::STRING_FUNCTION_INDEX, r0, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
r0, holder, r3, r1, r4, name, &miss);
break;
-
- case SYMBOL_CHECK:
+ }
+ case SYMBOL_CHECK: {
// Check that the object is a symbol.
__ CompareObjectType(r1, r1, r3, SYMBOL_TYPE);
__ b(ne, &miss);
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::SYMBOL_FUNCTION_INDEX, r0, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
r0, holder, r3, r1, r4, name, &miss);
break;
-
+ }
case NUMBER_CHECK: {
Label fast;
// Check that the object is a smi or a heap number.
@@ -2632,8 +2633,9 @@
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::NUMBER_FUNCTION_INDEX, r0, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
r0, holder, r3, r1, r4, name, &miss);
break;
}
@@ -2643,8 +2645,9 @@
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::BOOLEAN_FUNCTION_INDEX, r0, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
r0, holder, r3, r1, r4, name, &miss);
break;
}
@@ -2797,7 +2800,8 @@
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
// Stub never generated for non-global objects that require access checks.
ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
@@ -2823,7 +2827,8 @@
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
Register values[] = { value() };
GenerateFastApiCall(
@@ -2917,12 +2922,10 @@
}
-Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
- Handle<Object> object,
- Handle<JSObject> last,
- Handle<Name> name,
- Handle<JSGlobalObject> global) {
- NonexistentHandlerFrontend(object, last, name, global);
+Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
+ Handle<JSObject> last,
+ Handle<Name> name) {
+ NonexistentHandlerFrontend(type, last, name);
// Return undefined if maps of the full prototype chain are still the
// same and no global property with this name contains a value.
@@ -3018,14 +3021,14 @@
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
- Handle<Object> object,
+ Handle<Type> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
bool is_dont_delete) {
Label miss;
- HandlerFrontendHeader(object, receiver(), global, name, &miss);
+ HandlerFrontendHeader(type, receiver(), global, name, &miss);
// Get the value from the cell.
__ mov(r3, Operand(cell));
diff --git a/src/arraybuffer.js b/src/arraybuffer.js
index c5c98db..6125f0f 100644
--- a/src/arraybuffer.js
+++ b/src/arraybuffer.js
@@ -107,5 +107,3 @@
}
SetUpArrayBuffer();
-
-
diff --git a/src/assembler.cc b/src/assembler.cc
index fa0b4c3..febae63 100644
--- a/src/assembler.cc
+++ b/src/assembler.cc
@@ -1061,12 +1061,6 @@
}
-ExternalReference ExternalReference::random_uint32_function(
- Isolate* isolate) {
- return ExternalReference(Redirect(isolate, FUNCTION_ADDR(V8::Random)));
-}
-
-
ExternalReference ExternalReference::get_date_field_function(
Isolate* isolate) {
return ExternalReference(Redirect(isolate, FUNCTION_ADDR(JSDate::GetField)));
diff --git a/src/assembler.h b/src/assembler.h
index 049fa8c..0c706c4 100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -718,7 +718,6 @@
Isolate* isolate);
static ExternalReference flush_icache_function(Isolate* isolate);
static ExternalReference perform_gc_function(Isolate* isolate);
- static ExternalReference random_uint32_function(Isolate* isolate);
static ExternalReference transcendental_cache_array_address(Isolate* isolate);
static ExternalReference delete_handle_scope_extensions(Isolate* isolate);
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 322df91..67b5798 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1309,10 +1309,6 @@
// Initialize the embedder data slot.
Handle<FixedArray> embedder_data = factory->NewFixedArray(2);
native_context()->set_embedder_data(*embedder_data);
-
- // Allocate the random seed slot.
- Handle<ByteArray> random_seed = factory->NewByteArray(kRandomStateSize);
- native_context()->set_random_seed(*random_seed);
}
@@ -2636,10 +2632,31 @@
InitializeExperimentalGlobal();
if (!InstallExperimentalNatives()) return;
+ // We can't (de-)serialize typed arrays currently, but we are lucky: The state
+ // of the random number generator needs no initialization during snapshot
+ // creation time and we don't need trigonometric functions then.
if (!Serializer::enabled()) {
+ // Initially seed the per-context random number generator using the
+ // per-isolate random number generator.
+ const int num_elems = 2;
+ const int num_bytes = num_elems * sizeof(uint32_t);
+ uint32_t* state = reinterpret_cast<uint32_t*>(malloc(num_bytes));
+
+ do {
+ isolate->random_number_generator()->NextBytes(state, num_bytes);
+ } while (state[0] == 0 || state[1] == 0);
+
+ v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(state, num_bytes);
+ Utils::OpenHandle(*buffer)->set_should_be_freed(true);
+ v8::Local<v8::Uint32Array> ta = v8::Uint32Array::New(buffer, 0, num_elems);
Handle<JSBuiltinsObject> builtins(native_context()->builtins());
+ ForceSetProperty(builtins,
+ factory()->InternalizeOneByteString(
+ STATIC_ASCII_VECTOR("rngstate")),
+ Utils::OpenHandle(*ta),
+ NONE);
+
// Initialize trigonometric lookup tables and constants.
- // The snapshot cannot contain typed arrays, and we don't need it to.
const int table_num_bytes = TrigonometricLookupTable::table_num_bytes();
v8::Local<v8::ArrayBuffer> sin_buffer = v8::ArrayBuffer::New(
TrigonometricLookupTable::sin_table(), table_num_bytes);
@@ -2674,14 +2691,6 @@
NONE);
}
- // Initially seed the per-context random number generator
- // using the per-isolate random number generator.
- uint32_t* state = reinterpret_cast<uint32_t*>(
- native_context()->random_seed()->GetDataStartAddress());
- do {
- isolate->random_number_generator()->NextBytes(state, kRandomStateSize);
- } while (state[0] == 0 || state[1] == 0);
-
result_ = native_context();
}
diff --git a/src/builtins.h b/src/builtins.h
index ec78782..1a04ad8 100644
--- a/src/builtins.h
+++ b/src/builtins.h
@@ -114,6 +114,8 @@
Code::kNoExtraICState) \
V(NotifyStubFailure, BUILTIN, UNINITIALIZED, \
Code::kNoExtraICState) \
+ V(NotifyStubFailureSaveDoubles, BUILTIN, UNINITIALIZED, \
+ Code::kNoExtraICState) \
\
V(LoadIC_Miss, BUILTIN, UNINITIALIZED, \
Code::kNoExtraICState) \
@@ -403,6 +405,7 @@
static void Generate_NotifySoftDeoptimized(MacroAssembler* masm);
static void Generate_NotifyLazyDeoptimized(MacroAssembler* masm);
static void Generate_NotifyStubFailure(MacroAssembler* masm);
+ static void Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm);
static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm);
static void Generate_FunctionCall(MacroAssembler* masm);
diff --git a/src/checks.cc b/src/checks.cc
index e08cd7c..a4514bf 100644
--- a/src/checks.cc
+++ b/src/checks.cc
@@ -132,4 +132,3 @@
intptr_t HeapObjectTagMask() { return kHeapObjectTagMask; }
} } // namespace v8::internal
-
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 3d42483..894c3d3 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -188,7 +188,7 @@
if (!stack_parameter_count->IsConstant() &&
descriptor_->hint_stack_parameter_count_ < 0) {
HInstruction* constant_one = graph()->GetConstant1();
- stack_pop_count = Add<HAdd>(stack_parameter_count, constant_one);
+ stack_pop_count = AddUncasted<HAdd>(stack_parameter_count, constant_one);
stack_pop_count->ClearFlag(HValue::kCanOverflow);
// TODO(mvstanton): verify that stack_parameter_count+1 really fits in a
// smi.
@@ -915,14 +915,14 @@
Push(BuildBinaryOperation(
stub->operation(), left, right,
handle(Type::String(), isolate()), right_type,
- result_type, stub->fixed_right_arg(), true));
+ result_type, stub->fixed_right_arg()));
}
if_leftisstring.Else();
{
Push(BuildBinaryOperation(
stub->operation(), left, right,
left_type, right_type, result_type,
- stub->fixed_right_arg(), true));
+ stub->fixed_right_arg()));
}
if_leftisstring.End();
result = Pop();
@@ -934,14 +934,14 @@
Push(BuildBinaryOperation(
stub->operation(), left, right,
left_type, handle(Type::String(), isolate()),
- result_type, stub->fixed_right_arg(), true));
+ result_type, stub->fixed_right_arg()));
}
if_rightisstring.Else();
{
Push(BuildBinaryOperation(
stub->operation(), left, right,
left_type, right_type, result_type,
- stub->fixed_right_arg(), true));
+ stub->fixed_right_arg()));
}
if_rightisstring.End();
result = Pop();
@@ -950,7 +950,7 @@
result = BuildBinaryOperation(
stub->operation(), left, right,
left_type, right_type, result_type,
- stub->fixed_right_arg(), true);
+ stub->fixed_right_arg());
}
// If we encounter a generic argument, the number conversion is
diff --git a/src/contexts.h b/src/contexts.h
index 189c215..461c9dc 100644
--- a/src/contexts.h
+++ b/src/contexts.h
@@ -184,8 +184,7 @@
strict_mode_generator_function_map) \
V(GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX, Map, \
generator_object_prototype_map) \
- V(GENERATOR_RESULT_MAP_INDEX, Map, generator_result_map) \
- V(RANDOM_SEED_INDEX, ByteArray, random_seed)
+ V(GENERATOR_RESULT_MAP_INDEX, Map, generator_result_map)
// JSFunctions are pairs (context, function code), sometimes also called
// closures. A Context object is used to represent function contexts and
@@ -332,7 +331,6 @@
STRICT_MODE_GENERATOR_FUNCTION_MAP_INDEX,
GENERATOR_OBJECT_PROTOTYPE_MAP_INDEX,
GENERATOR_RESULT_MAP_INDEX,
- RANDOM_SEED_INDEX,
// Properties from here are treated as weak references by the full GC.
// Scavenge treats them as strong references.
diff --git a/src/d8-debug.cc b/src/d8-debug.cc
index 379631c..6c297d7 100644
--- a/src/d8-debug.cc
+++ b/src/d8-debug.cc
@@ -63,7 +63,8 @@
TryCatch try_catch;
// Get the toJSONProtocol function on the event and get the JSON format.
- Local<String> to_json_fun_name = String::New("toJSONProtocol");
+ Local<String> to_json_fun_name =
+ String::NewFromUtf8(isolate, "toJSONProtocol");
Handle<Object> event_data = event_details.GetEventData();
Local<Function> to_json_fun =
Local<Function>::Cast(event_data->Get(to_json_fun_name));
@@ -80,7 +81,7 @@
Shell::ReportException(isolate, &try_catch);
return;
}
- String::Utf8Value str(details->Get(String::New("text")));
+ String::Utf8Value str(details->Get(String::NewFromUtf8(isolate, "text")));
if (str.length() == 0) {
// Empty string is used to signal not to process this event.
return;
@@ -88,7 +89,8 @@
printf("%s\n", *str);
// Get the debug command processor.
- Local<String> fun_name = String::New("debugCommandProcessor");
+ Local<String> fun_name =
+ String::NewFromUtf8(isolate, "debugCommandProcessor");
Handle<Object> exec_state = event_details.GetExecutionState();
Local<Function> fun = Local<Function>::Cast(exec_state->Get(fun_name));
Local<Object> cmd_processor =
@@ -112,8 +114,8 @@
TryCatch try_catch;
// Convert the debugger command to a JSON debugger request.
- Handle<Value> request =
- Shell::DebugCommandToJSONRequest(isolate, String::New(command));
+ Handle<Value> request = Shell::DebugCommandToJSONRequest(
+ isolate, String::NewFromUtf8(isolate, command));
if (try_catch.HasCaught()) {
Shell::ReportException(isolate, &try_catch);
continue;
@@ -134,7 +136,7 @@
// Invoke the JavaScript to convert the debug command line to a JSON
// request, invoke the JSON request and convert the JSON respose to a text
// representation.
- fun_name = String::New("processDebugRequest");
+ fun_name = String::NewFromUtf8(isolate, "processDebugRequest");
fun = Handle<Function>::Cast(cmd_processor->Get(fun_name));
args[0] = request;
Handle<Value> response_val = fun->Call(cmd_processor, kArgc, args);
@@ -151,12 +153,14 @@
Shell::ReportException(isolate, &try_catch);
continue;
}
- String::Utf8Value text_str(response_details->Get(String::New("text")));
+ String::Utf8Value text_str(
+ response_details->Get(String::NewFromUtf8(isolate, "text")));
if (text_str.length() > 0) {
printf("%s\n", *text_str);
}
- running =
- response_details->Get(String::New("running"))->ToBoolean()->Value();
+ running = response_details->Get(String::NewFromUtf8(isolate, "running"))
+ ->ToBoolean()
+ ->Value();
}
}
@@ -273,15 +277,14 @@
// Print the event details.
TryCatch try_catch;
- Handle<Object> details =
- Shell::DebugMessageDetails(isolate_,
- Handle<String>::Cast(String::New(message)));
+ Handle<Object> details = Shell::DebugMessageDetails(
+ isolate_, Handle<String>::Cast(String::NewFromUtf8(isolate_, message)));
if (try_catch.HasCaught()) {
Shell::ReportException(isolate_, &try_catch);
PrintPrompt();
return;
}
- String::Utf8Value str(details->Get(String::New("text")));
+ String::Utf8Value str(details->Get(String::NewFromUtf8(isolate_, "text")));
if (str.length() == 0) {
// Empty string is used to signal not to process this event.
return;
@@ -292,7 +295,9 @@
printf("???\n");
}
- bool is_running = details->Get(String::New("running"))->ToBoolean()->Value();
+ bool is_running = details->Get(String::NewFromUtf8(isolate_, "running"))
+ ->ToBoolean()
+ ->Value();
PrintPrompt(is_running);
}
@@ -303,8 +308,8 @@
// Convert the debugger command to a JSON debugger request.
TryCatch try_catch;
- Handle<Value> request =
- Shell::DebugCommandToJSONRequest(isolate_, String::New(command));
+ Handle<Value> request = Shell::DebugCommandToJSONRequest(
+ isolate_, String::NewFromUtf8(isolate_, command));
if (try_catch.HasCaught()) {
Shell::ReportException(isolate_, &try_catch);
PrintPrompt();
diff --git a/src/d8-posix.cc b/src/d8-posix.cc
index 81c15ae..dc60d0c 100644
--- a/src/d8-posix.cc
+++ b/src/d8-posix.cc
@@ -188,12 +188,12 @@
ExecArgs() {
exec_args_[0] = NULL;
}
- bool Init(Handle<Value> arg0, Handle<Array> command_args) {
+ bool Init(Isolate* isolate, Handle<Value> arg0, Handle<Array> command_args) {
String::Utf8Value prog(arg0);
if (*prog == NULL) {
const char* message =
"os.system(): String conversion of program name failed";
- ThrowException(String::New(message));
+ isolate->ThrowException(String::NewFromUtf8(isolate, message));
return false;
}
int len = prog.length() + 3;
@@ -208,7 +208,7 @@
exec_args_[i] = NULL; // Consistent state for destructor.
const char* message =
"os.system(): String conversion of argument failed.";
- ThrowException(String::New(message));
+ isolate->ThrowException(String::NewFromUtf8(isolate, message));
return false;
}
int len = utf8_arg.length() + 1;
@@ -245,8 +245,8 @@
if (args[3]->IsNumber()) {
*total_timeout = args[3]->Int32Value();
} else {
- args.GetIsolate()->ThrowException(
- String::New("system: Argument 4 must be a number"));
+ args.GetIsolate()->ThrowException(String::NewFromUtf8(
+ args.GetIsolate(), "system: Argument 4 must be a number"));
return false;
}
}
@@ -254,8 +254,8 @@
if (args[2]->IsNumber()) {
*read_timeout = args[2]->Int32Value();
} else {
- args.GetIsolate()->ThrowException(
- String::New("system: Argument 3 must be a number"));
+ args.GetIsolate()->ThrowException(String::NewFromUtf8(
+ args.GetIsolate(), "system: Argument 3 must be a number"));
return false;
}
}
@@ -293,14 +293,14 @@
// Runs in the parent process. Checks that the child was able to exec (closing
// the file desriptor), or reports an error if it failed.
-static bool ChildLaunchedOK(int* exec_error_fds) {
+static bool ChildLaunchedOK(Isolate* isolate, int* exec_error_fds) {
int bytes_read;
int err;
do {
bytes_read = read(exec_error_fds[kReadFD], &err, sizeof(err));
} while (bytes_read == -1 && errno == EINTR);
if (bytes_read != 0) {
- ThrowException(String::New(strerror(err)));
+ isolate->ThrowException(String::NewFromUtf8(isolate, strerror(err)));
return false;
}
return true;
@@ -309,7 +309,8 @@
// Accumulates the output from the child in a string handle. Returns true if it
// succeeded or false if an exception was thrown.
-static Handle<Value> GetStdout(int child_fd,
+static Handle<Value> GetStdout(Isolate* isolate,
+ int child_fd,
struct timeval& start_time,
int read_timeout,
int total_timeout) {
@@ -320,7 +321,8 @@
char buffer[kStdoutReadBufferSize];
if (fcntl(child_fd, F_SETFL, O_NONBLOCK) != 0) {
- return ThrowException(String::New(strerror(errno)));
+ return isolate->ThrowException(
+ String::NewFromUtf8(isolate, strerror(errno)));
}
int bytes_read;
@@ -335,7 +337,8 @@
total_timeout,
start_time) ||
(TimeIsOut(start_time, total_timeout))) {
- return ThrowException(String::New("Timed out waiting for output"));
+ return isolate->ThrowException(
+ String::NewFromUtf8(isolate, "Timed out waiting for output"));
}
continue;
} else if (errno == EINTR) {
@@ -348,7 +351,8 @@
int length = bytes_read == 0 ?
bytes_read + fullness :
LengthWithoutIncompleteUtf8(buffer, bytes_read + fullness);
- Handle<String> addition = String::New(buffer, length);
+ Handle<String> addition =
+ String::NewFromUtf8(isolate, buffer, String::kNormalString, length);
accumulator = String::Concat(accumulator, addition);
fullness = bytes_read + fullness - length;
memcpy(buffer, buffer + length, fullness);
@@ -377,7 +381,8 @@
// Get exit status of child.
-static bool WaitForChild(int pid,
+static bool WaitForChild(Isolate* isolate,
+ int pid,
ZombieProtector& child_waiter,
struct timeval& start_time,
int read_timeout,
@@ -394,7 +399,8 @@
if (useconds < 1000000) useconds <<= 1;
if ((read_timeout != -1 && useconds / 1000 > read_timeout) ||
(TimeIsOut(start_time, total_timeout))) {
- ThrowException(String::New("Timed out waiting for process to terminate"));
+ isolate->ThrowException(String::NewFromUtf8(
+ isolate, "Timed out waiting for process to terminate"));
kill(pid, SIGINT);
return false;
}
@@ -405,7 +411,7 @@
sizeof(message),
"Child killed by signal %d",
child_info.si_status);
- ThrowException(String::New(message));
+ isolate->ThrowException(String::NewFromUtf8(isolate, message));
return false;
}
if (child_info.si_code == CLD_EXITED && child_info.si_status != 0) {
@@ -414,7 +420,7 @@
sizeof(message),
"Child exited with status %d",
child_info.si_status);
- ThrowException(String::New(message));
+ isolate->ThrowException(String::NewFromUtf8(isolate, message));
return false;
}
@@ -429,7 +435,7 @@
sizeof(message),
"Child killed by signal %d",
WTERMSIG(child_status));
- ThrowException(String::New(message));
+ isolate->ThrowException(String::NewFromUtf8(isolate, message));
return false;
}
if (WEXITSTATUS(child_status) != 0) {
@@ -439,7 +445,7 @@
sizeof(message),
"Child exited with status %d",
exit_status);
- ThrowException(String::New(message));
+ isolate->ThrowException(String::NewFromUtf8(isolate, message));
return false;
}
@@ -458,8 +464,8 @@
Handle<Array> command_args;
if (args.Length() > 1) {
if (!args[1]->IsArray()) {
- args.GetIsolate()->ThrowException(
- String::New("system: Argument 2 must be an array"));
+ args.GetIsolate()->ThrowException(String::NewFromUtf8(
+ args.GetIsolate(), "system: Argument 2 must be an array"));
return;
}
command_args = Handle<Array>::Cast(args[1]);
@@ -467,13 +473,13 @@
command_args = Array::New(0);
}
if (command_args->Length() > ExecArgs::kMaxArgs) {
- args.GetIsolate()->ThrowException(
- String::New("Too many arguments to system()"));
+ args.GetIsolate()->ThrowException(String::NewFromUtf8(
+ args.GetIsolate(), "Too many arguments to system()"));
return;
}
if (args.Length() < 1) {
- args.GetIsolate()->ThrowException(
- String::New("Too few arguments to system()"));
+ args.GetIsolate()->ThrowException(String::NewFromUtf8(
+ args.GetIsolate(), "Too few arguments to system()"));
return;
}
@@ -481,7 +487,7 @@
gettimeofday(&start_time, NULL);
ExecArgs exec_args;
- if (!exec_args.Init(args[0], command_args)) {
+ if (!exec_args.Init(args.GetIsolate(), args[0], command_args)) {
return;
}
int exec_error_fds[2];
@@ -489,12 +495,12 @@
if (pipe(exec_error_fds) != 0) {
args.GetIsolate()->ThrowException(
- String::New("pipe syscall failed."));
+ String::NewFromUtf8(args.GetIsolate(), "pipe syscall failed."));
return;
}
if (pipe(stdout_fds) != 0) {
args.GetIsolate()->ThrowException(
- String::New("pipe syscall failed."));
+ String::NewFromUtf8(args.GetIsolate(), "pipe syscall failed."));
return;
}
@@ -511,9 +517,10 @@
OpenFDCloser error_read_closer(exec_error_fds[kReadFD]);
OpenFDCloser stdout_read_closer(stdout_fds[kReadFD]);
- if (!ChildLaunchedOK(exec_error_fds)) return;
+ if (!ChildLaunchedOK(args.GetIsolate(), exec_error_fds)) return;
- Handle<Value> accumulator = GetStdout(stdout_fds[kReadFD],
+ Handle<Value> accumulator = GetStdout(args.GetIsolate(),
+ stdout_fds[kReadFD],
start_time,
read_timeout,
total_timeout);
@@ -523,7 +530,8 @@
return;
}
- if (!WaitForChild(pid,
+ if (!WaitForChild(args.GetIsolate(),
+ pid,
child_waiter,
start_time,
read_timeout,
@@ -538,17 +546,20 @@
void Shell::ChangeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1) {
const char* message = "chdir() takes one argument";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
String::Utf8Value directory(args[0]);
if (*directory == NULL) {
const char* message = "os.chdir(): String conversion of argument failed.";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
if (chdir(*directory) != 0) {
- args.GetIsolate()->ThrowException(String::New(strerror(errno)));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), strerror(errno)));
return;
}
}
@@ -557,7 +568,8 @@
void Shell::SetUMask(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1) {
const char* message = "umask() takes one argument";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
if (args[0]->IsNumber()) {
@@ -567,50 +579,51 @@
return;
} else {
const char* message = "umask() argument must be numeric";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
}
-static bool CheckItsADirectory(char* directory) {
+static bool CheckItsADirectory(Isolate* isolate, char* directory) {
struct stat stat_buf;
int stat_result = stat(directory, &stat_buf);
if (stat_result != 0) {
- ThrowException(String::New(strerror(errno)));
+ isolate->ThrowException(String::NewFromUtf8(isolate, strerror(errno)));
return false;
}
if ((stat_buf.st_mode & S_IFDIR) != 0) return true;
- ThrowException(String::New(strerror(EEXIST)));
+ isolate->ThrowException(String::NewFromUtf8(isolate, strerror(EEXIST)));
return false;
}
// Returns true for success. Creates intermediate directories as needed. No
// error if the directory exists already.
-static bool mkdirp(char* directory, mode_t mask) {
+static bool mkdirp(Isolate* isolate, char* directory, mode_t mask) {
int result = mkdir(directory, mask);
if (result == 0) return true;
if (errno == EEXIST) {
- return CheckItsADirectory(directory);
+ return CheckItsADirectory(isolate, directory);
} else if (errno == ENOENT) { // Intermediate path element is missing.
char* last_slash = strrchr(directory, '/');
if (last_slash == NULL) {
- ThrowException(String::New(strerror(errno)));
+ isolate->ThrowException(String::NewFromUtf8(isolate, strerror(errno)));
return false;
}
*last_slash = 0;
- if (!mkdirp(directory, mask)) return false;
+ if (!mkdirp(isolate, directory, mask)) return false;
*last_slash = '/';
result = mkdir(directory, mask);
if (result == 0) return true;
if (errno == EEXIST) {
- return CheckItsADirectory(directory);
+ return CheckItsADirectory(isolate, directory);
}
- ThrowException(String::New(strerror(errno)));
+ isolate->ThrowException(String::NewFromUtf8(isolate, strerror(errno)));
return false;
} else {
- ThrowException(String::New(strerror(errno)));
+ isolate->ThrowException(String::NewFromUtf8(isolate, strerror(errno)));
return false;
}
}
@@ -623,34 +636,39 @@
mask = args[1]->Int32Value();
} else {
const char* message = "mkdirp() second argument must be numeric";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
} else if (args.Length() != 1) {
const char* message = "mkdirp() takes one or two arguments";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
String::Utf8Value directory(args[0]);
if (*directory == NULL) {
const char* message = "os.mkdirp(): String conversion of argument failed.";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
- mkdirp(*directory, mask);
+ mkdirp(args.GetIsolate(), *directory, mask);
}
void Shell::RemoveDirectory(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1) {
const char* message = "rmdir() takes one or two arguments";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
String::Utf8Value directory(args[0]);
if (*directory == NULL) {
const char* message = "os.rmdir(): String conversion of argument failed.";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
rmdir(*directory);
@@ -660,7 +678,8 @@
void Shell::SetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 2) {
const char* message = "setenv() takes two arguments";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
String::Utf8Value var(args[0]);
@@ -668,13 +687,15 @@
if (*var == NULL) {
const char* message =
"os.setenv(): String conversion of variable name failed.";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
if (*value == NULL) {
const char* message =
"os.setenv(): String conversion of variable contents failed.";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
setenv(*var, *value, 1);
@@ -684,29 +705,37 @@
void Shell::UnsetEnvironment(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1) {
const char* message = "unsetenv() takes one argument";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
String::Utf8Value var(args[0]);
if (*var == NULL) {
const char* message =
"os.setenv(): String conversion of variable name failed.";
- args.GetIsolate()->ThrowException(String::New(message));
+ args.GetIsolate()->ThrowException(
+ String::NewFromUtf8(args.GetIsolate(), message));
return;
}
unsetenv(*var);
}
-void Shell::AddOSMethods(Handle<ObjectTemplate> os_templ) {
- os_templ->Set(String::New("system"), FunctionTemplate::New(System));
- os_templ->Set(String::New("chdir"), FunctionTemplate::New(ChangeDirectory));
- os_templ->Set(String::New("setenv"), FunctionTemplate::New(SetEnvironment));
- os_templ->Set(String::New("unsetenv"),
+void Shell::AddOSMethods(Isolate* isolate, Handle<ObjectTemplate> os_templ) {
+ os_templ->Set(String::NewFromUtf8(isolate, "system"),
+ FunctionTemplate::New(System));
+ os_templ->Set(String::NewFromUtf8(isolate, "chdir"),
+ FunctionTemplate::New(ChangeDirectory));
+ os_templ->Set(String::NewFromUtf8(isolate, "setenv"),
+ FunctionTemplate::New(SetEnvironment));
+ os_templ->Set(String::NewFromUtf8(isolate, "unsetenv"),
FunctionTemplate::New(UnsetEnvironment));
- os_templ->Set(String::New("umask"), FunctionTemplate::New(SetUMask));
- os_templ->Set(String::New("mkdirp"), FunctionTemplate::New(MakeDirectory));
- os_templ->Set(String::New("rmdir"), FunctionTemplate::New(RemoveDirectory));
+ os_templ->Set(String::NewFromUtf8(isolate, "umask"),
+ FunctionTemplate::New(SetUMask));
+ os_templ->Set(String::NewFromUtf8(isolate, "mkdirp"),
+ FunctionTemplate::New(MakeDirectory));
+ os_templ->Set(String::NewFromUtf8(isolate, "rmdir"),
+ FunctionTemplate::New(RemoveDirectory));
}
} // namespace v8
diff --git a/src/d8-readline.cc b/src/d8-readline.cc
index 0226f31..15b1361 100644
--- a/src/d8-readline.cc
+++ b/src/d8-readline.cc
@@ -109,12 +109,9 @@
Unlocker unlock(Isolate::GetCurrent());
result = readline(prompt);
}
- if (result != NULL) {
- AddHistory(result);
- } else {
- return Handle<String>();
- }
- return String::New(result);
+ if (result == NULL) return Handle<String>();
+ AddHistory(result);
+ return String::NewFromUtf8(isolate_, result);
}
@@ -153,8 +150,13 @@
HandleScope scope(isolate);
Handle<Array> completions;
if (state == 0) {
- Local<String> full_text = String::New(rl_line_buffer, rl_point);
- completions = Shell::GetCompletions(isolate, String::New(text), full_text);
+ Local<String> full_text = String::NewFromUtf8(isolate,
+ rl_line_buffer,
+ String::kNormalString,
+ rl_point);
+ completions = Shell::GetCompletions(isolate,
+ String::NewFromUtf8(isolate, text),
+ full_text);
current_completions.Reset(isolate, completions);
current_index = 0;
} else {
diff --git a/src/d8-windows.cc b/src/d8-windows.cc
index eeb4735..edf5085 100644
--- a/src/d8-windows.cc
+++ b/src/d8-windows.cc
@@ -35,7 +35,7 @@
namespace v8 {
-void Shell::AddOSMethods(Handle<ObjectTemplate> os_templ) {
+void Shell::AddOSMethods(Isolate* isolate, Handle<ObjectTemplate> os_templ) {
}
diff --git a/src/d8.cc b/src/d8.cc
index 41b08bc..d0ca550 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -80,8 +80,8 @@
namespace v8 {
-static Handle<Value> Throw(const char* message) {
- return ThrowException(String::New(message));
+static Handle<Value> Throw(Isolate* isolate, const char* message) {
+ return isolate->ThrowException(String::NewFromUtf8(isolate, message));
}
@@ -244,7 +244,8 @@
v8::Local<v8::Context>::New(isolate, utility_context_);
v8::Context::Scope context_scope(context);
Handle<Object> global = context->Global();
- Handle<Value> fun = global->Get(String::New("Stringify"));
+ Handle<Value> fun =
+ global->Get(String::NewFromUtf8(isolate, "Stringify"));
Handle<Value> argv[1] = { result };
Handle<Value> s = Handle<Function>::Cast(fun)->Call(global, 1, argv);
if (try_catch.HasCaught()) return true;
@@ -267,17 +268,16 @@
data_->realms_ = new Persistent<Context>[1];
data_->realms_[0].Reset(data_->isolate_,
data_->isolate_->GetEnteredContext());
- data_->realm_shared_.Clear();
}
PerIsolateData::RealmScope::~RealmScope() {
// Drop realms to avoid keeping them alive.
for (int i = 0; i < data_->realm_count_; ++i)
- data_->realms_[i].Dispose();
+ data_->realms_[i].Reset();
delete[] data_->realms_;
if (!data_->realm_shared_.IsEmpty())
- data_->realm_shared_.Dispose();
+ data_->realm_shared_.Reset();
}
@@ -313,7 +313,7 @@
Isolate* isolate = args.GetIsolate();
PerIsolateData* data = PerIsolateData::Get(isolate);
if (args.Length() < 1 || !args[0]->IsObject()) {
- Throw("Invalid argument");
+ Throw(args.GetIsolate(), "Invalid argument");
return;
}
int index = data->RealmFind(args[0]->ToObject()->CreationContext());
@@ -327,12 +327,12 @@
void Shell::RealmGlobal(const v8::FunctionCallbackInfo<v8::Value>& args) {
PerIsolateData* data = PerIsolateData::Get(args.GetIsolate());
if (args.Length() < 1 || !args[0]->IsNumber()) {
- Throw("Invalid argument");
+ Throw(args.GetIsolate(), "Invalid argument");
return;
}
int index = args[0]->Uint32Value();
if (index >= data->realm_count_ || data->realms_[index].IsEmpty()) {
- Throw("Invalid realm index");
+ Throw(args.GetIsolate(), "Invalid realm index");
return;
}
args.GetReturnValue().Set(
@@ -363,18 +363,17 @@
Isolate* isolate = args.GetIsolate();
PerIsolateData* data = PerIsolateData::Get(isolate);
if (args.Length() < 1 || !args[0]->IsNumber()) {
- Throw("Invalid argument");
+ Throw(args.GetIsolate(), "Invalid argument");
return;
}
int index = args[0]->Uint32Value();
if (index >= data->realm_count_ || data->realms_[index].IsEmpty() ||
index == 0 ||
index == data->realm_current_ || index == data->realm_switch_) {
- Throw("Invalid realm index");
+ Throw(args.GetIsolate(), "Invalid realm index");
return;
}
- data->realms_[index].Dispose();
- data->realms_[index].Clear();
+ data->realms_[index].Reset();
}
@@ -383,12 +382,12 @@
Isolate* isolate = args.GetIsolate();
PerIsolateData* data = PerIsolateData::Get(isolate);
if (args.Length() < 1 || !args[0]->IsNumber()) {
- Throw("Invalid argument");
+ Throw(args.GetIsolate(), "Invalid argument");
return;
}
int index = args[0]->Uint32Value();
if (index >= data->realm_count_ || data->realms_[index].IsEmpty()) {
- Throw("Invalid realm index");
+ Throw(args.GetIsolate(), "Invalid realm index");
return;
}
data->realm_switch_ = index;
@@ -400,12 +399,12 @@
Isolate* isolate = args.GetIsolate();
PerIsolateData* data = PerIsolateData::Get(isolate);
if (args.Length() < 2 || !args[0]->IsNumber() || !args[1]->IsString()) {
- Throw("Invalid argument");
+ Throw(args.GetIsolate(), "Invalid argument");
return;
}
int index = args[0]->Uint32Value();
if (index >= data->realm_count_ || data->realms_[index].IsEmpty()) {
- Throw("Invalid realm index");
+ Throw(args.GetIsolate(), "Invalid realm index");
return;
}
Handle<Script> script = Script::New(args[1]->ToString());
@@ -432,7 +431,6 @@
const PropertyCallbackInfo<void>& info) {
Isolate* isolate = info.GetIsolate();
PerIsolateData* data = PerIsolateData::Get(isolate);
- if (!data->realm_shared_.IsEmpty()) data->realm_shared_.Dispose();
data->realm_shared_.Reset(isolate, value);
}
@@ -472,12 +470,12 @@
void Shell::Read(const v8::FunctionCallbackInfo<v8::Value>& args) {
String::Utf8Value file(args[0]);
if (*file == NULL) {
- Throw("Error loading file");
+ Throw(args.GetIsolate(), "Error loading file");
return;
}
Handle<String> source = ReadFile(args.GetIsolate(), *file);
if (source.IsEmpty()) {
- Throw("Error loading file");
+ Throw(args.GetIsolate(), "Error loading file");
return;
}
args.GetReturnValue().Set(source);
@@ -487,7 +485,7 @@
Handle<String> Shell::ReadFromStdin(Isolate* isolate) {
static const int kBufferSize = 256;
char buffer[kBufferSize];
- Handle<String> accumulator = String::New("");
+ Handle<String> accumulator = String::NewFromUtf8(isolate, "");
int length;
while (true) {
// Continue reading if the line ends with an escape '\\' or the line has
@@ -503,12 +501,18 @@
if (length == 0) {
return accumulator;
} else if (buffer[length-1] != '\n') {
- accumulator = String::Concat(accumulator, String::New(buffer, length));
+ accumulator = String::Concat(
+ accumulator,
+ String::NewFromUtf8(isolate, buffer, String::kNormalString, length));
} else if (length > 1 && buffer[length-2] == '\\') {
buffer[length-2] = '\n';
- accumulator = String::Concat(accumulator, String::New(buffer, length-1));
+ accumulator = String::Concat(
+ accumulator, String::NewFromUtf8(isolate, buffer,
+ String::kNormalString, length - 1));
} else {
- return String::Concat(accumulator, String::New(buffer, length-1));
+ return String::Concat(
+ accumulator, String::NewFromUtf8(isolate, buffer,
+ String::kNormalString, length - 1));
}
}
}
@@ -519,20 +523,20 @@
HandleScope handle_scope(args.GetIsolate());
String::Utf8Value file(args[i]);
if (*file == NULL) {
- Throw("Error loading file");
+ Throw(args.GetIsolate(), "Error loading file");
return;
}
Handle<String> source = ReadFile(args.GetIsolate(), *file);
if (source.IsEmpty()) {
- Throw("Error loading file");
+ Throw(args.GetIsolate(), "Error loading file");
return;
}
if (!ExecuteString(args.GetIsolate(),
source,
- String::New(*file),
+ String::NewFromUtf8(args.GetIsolate(), *file),
false,
true)) {
- Throw("Error executing file");
+ Throw(args.GetIsolate(), "Error executing file");
return;
}
}
@@ -547,7 +551,8 @@
void Shell::Version(const v8::FunctionCallbackInfo<v8::Value>& args) {
- args.GetReturnValue().Set(String::New(V8::GetVersion()));
+ args.GetReturnValue().Set(
+ String::NewFromUtf8(args.GetIsolate(), V8::GetVersion()));
}
@@ -555,7 +560,7 @@
HandleScope handle_scope(isolate);
#if !defined(V8_SHARED) && defined(ENABLE_DEBUGGER_SUPPORT)
Handle<Context> utility_context;
- bool enter_context = !Context::InContext();
+ bool enter_context = !isolate->InContext();
if (enter_context) {
utility_context = Local<Context>::New(isolate, utility_context_);
utility_context->Enter();
@@ -610,7 +615,8 @@
v8::Local<v8::Context>::New(isolate, utility_context_);
v8::Context::Scope context_scope(utility_context);
Handle<Object> global = utility_context->Global();
- Handle<Value> fun = global->Get(String::New("GetCompletions"));
+ Handle<Value> fun =
+ global->Get(String::NewFromUtf8(isolate, "GetCompletions"));
static const int kArgc = 3;
v8::Local<v8::Context> evaluation_context =
v8::Local<v8::Context>::New(isolate, evaluation_context_);
@@ -628,7 +634,8 @@
v8::Local<v8::Context>::New(isolate, utility_context_);
v8::Context::Scope context_scope(context);
Handle<Object> global = context->Global();
- Handle<Value> fun = global->Get(String::New("DebugMessageDetails"));
+ Handle<Value> fun =
+ global->Get(String::NewFromUtf8(isolate, "DebugMessageDetails"));
static const int kArgc = 1;
Handle<Value> argv[kArgc] = { message };
Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
@@ -643,7 +650,8 @@
v8::Local<v8::Context>::New(isolate, utility_context_);
v8::Context::Scope context_scope(context);
Handle<Object> global = context->Global();
- Handle<Value> fun = global->Get(String::New("DebugCommandToJSONRequest"));
+ Handle<Value> fun =
+ global->Get(String::NewFromUtf8(isolate, "DebugCommandToJSONRequest"));
static const int kArgc = 1;
Handle<Value> argv[kArgc] = { command };
Handle<Value> val = Handle<Function>::Cast(fun)->Call(global, kArgc, argv);
@@ -782,8 +790,8 @@
debug->Load();
i::Handle<i::JSObject> js_debug
= i::Handle<i::JSObject>(debug->debug_context()->global_object());
- utility_context->Global()->Set(String::New("$debug"),
- Utils::ToLocal(js_debug));
+ utility_context->Global()->Set(String::NewFromUtf8(isolate, "$debug"),
+ Utils::ToLocal(js_debug));
debug->debug_context()->set_security_token(
reinterpret_cast<i::Isolate*>(isolate)->heap()->undefined_value());
#endif // ENABLE_DEBUGGER_SUPPORT
@@ -794,10 +802,12 @@
i::NativesCollection<i::D8>::GetRawScriptSource(source_index);
i::Vector<const char> shell_source_name =
i::NativesCollection<i::D8>::GetScriptName(source_index);
- Handle<String> source = String::New(shell_source.start(),
- shell_source.length());
- Handle<String> name = String::New(shell_source_name.start(),
- shell_source_name.length());
+ Handle<String> source =
+ String::NewFromUtf8(isolate, shell_source.start(), String::kNormalString,
+ shell_source.length());
+ Handle<String> name =
+ String::NewFromUtf8(isolate, shell_source_name.start(),
+ String::kNormalString, shell_source_name.length());
Handle<Script> script = Script::Compile(source, name);
script->Run();
// Mark the d8 shell script as native to avoid it showing up as normal source
@@ -850,48 +860,55 @@
Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
Handle<ObjectTemplate> global_template = ObjectTemplate::New();
- global_template->Set(String::New("print"), FunctionTemplate::New(Print));
- global_template->Set(String::New("write"), FunctionTemplate::New(Write));
- global_template->Set(String::New("read"), FunctionTemplate::New(Read));
- global_template->Set(String::New("readbuffer"),
+ global_template->Set(String::NewFromUtf8(isolate, "print"),
+ FunctionTemplate::New(Print));
+ global_template->Set(String::NewFromUtf8(isolate, "write"),
+ FunctionTemplate::New(Write));
+ global_template->Set(String::NewFromUtf8(isolate, "read"),
+ FunctionTemplate::New(Read));
+ global_template->Set(String::NewFromUtf8(isolate, "readbuffer"),
FunctionTemplate::New(ReadBuffer));
- global_template->Set(String::New("readline"),
+ global_template->Set(String::NewFromUtf8(isolate, "readline"),
FunctionTemplate::New(ReadLine));
- global_template->Set(String::New("load"), FunctionTemplate::New(Load));
- global_template->Set(String::New("quit"), FunctionTemplate::New(Quit));
- global_template->Set(String::New("version"), FunctionTemplate::New(Version));
+ global_template->Set(String::NewFromUtf8(isolate, "load"),
+ FunctionTemplate::New(Load));
+ global_template->Set(String::NewFromUtf8(isolate, "quit"),
+ FunctionTemplate::New(Quit));
+ global_template->Set(String::NewFromUtf8(isolate, "version"),
+ FunctionTemplate::New(Version));
// Bind the Realm object.
Handle<ObjectTemplate> realm_template = ObjectTemplate::New();
- realm_template->Set(String::New("current"),
+ realm_template->Set(String::NewFromUtf8(isolate, "current"),
FunctionTemplate::New(RealmCurrent));
- realm_template->Set(String::New("owner"),
+ realm_template->Set(String::NewFromUtf8(isolate, "owner"),
FunctionTemplate::New(RealmOwner));
- realm_template->Set(String::New("global"),
+ realm_template->Set(String::NewFromUtf8(isolate, "global"),
FunctionTemplate::New(RealmGlobal));
- realm_template->Set(String::New("create"),
+ realm_template->Set(String::NewFromUtf8(isolate, "create"),
FunctionTemplate::New(RealmCreate));
- realm_template->Set(String::New("dispose"),
+ realm_template->Set(String::NewFromUtf8(isolate, "dispose"),
FunctionTemplate::New(RealmDispose));
- realm_template->Set(String::New("switch"),
+ realm_template->Set(String::NewFromUtf8(isolate, "switch"),
FunctionTemplate::New(RealmSwitch));
- realm_template->Set(String::New("eval"),
+ realm_template->Set(String::NewFromUtf8(isolate, "eval"),
FunctionTemplate::New(RealmEval));
- realm_template->SetAccessor(String::New("shared"),
+ realm_template->SetAccessor(String::NewFromUtf8(isolate, "shared"),
RealmSharedGet, RealmSharedSet);
- global_template->Set(String::New("Realm"), realm_template);
+ global_template->Set(String::NewFromUtf8(isolate, "Realm"), realm_template);
#ifndef V8_SHARED
Handle<ObjectTemplate> performance_template = ObjectTemplate::New();
- performance_template->Set(String::New("now"),
+ performance_template->Set(String::NewFromUtf8(isolate, "now"),
FunctionTemplate::New(PerformanceNow));
- global_template->Set(String::New("performance"), performance_template);
+ global_template->Set(String::NewFromUtf8(isolate, "performance"),
+ performance_template);
#endif // V8_SHARED
#if !defined(V8_SHARED) && !defined(_WIN32) && !defined(_WIN64)
Handle<ObjectTemplate> os_templ = ObjectTemplate::New();
- AddOSMethods(os_templ);
- global_template->Set(String::New("os"), os_templ);
+ AddOSMethods(isolate, os_templ);
+ global_template->Set(String::NewFromUtf8(isolate, "os"), os_templ);
#endif // V8_SHARED
return global_template;
@@ -966,7 +983,7 @@
}
i::Handle<i::JSArray> arguments_jsarray =
factory->NewJSArrayWithElements(arguments_array);
- context->Global()->Set(String::New("arguments"),
+ context->Global()->Set(String::NewFromUtf8(isolate, "arguments"),
Utils::ToLocal(arguments_jsarray));
#endif // V8_SHARED
return handle_scope.Close(context);
@@ -1089,7 +1106,7 @@
-static_cast<intptr_t>(byte_length));
delete[] data;
- array_buffer->Dispose();
+ array_buffer->Reset();
}
@@ -1098,7 +1115,7 @@
String::Utf8Value filename(args[0]);
int length;
if (*filename == NULL) {
- Throw("Error loading file");
+ Throw(args.GetIsolate(), "Error loading file");
return;
}
@@ -1106,7 +1123,7 @@
uint8_t* data = reinterpret_cast<uint8_t*>(
ReadChars(args.GetIsolate(), *filename, &length));
if (data == NULL) {
- Throw("Error reading file");
+ Throw(args.GetIsolate(), "Error reading file");
return;
}
Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(data, length);
@@ -1147,7 +1164,8 @@
int size = 0;
char* chars = ReadChars(isolate, name, &size);
if (chars == NULL) return Handle<String>();
- Handle<String> result = String::New(chars, size);
+ Handle<String> result =
+ String::NewFromUtf8(isolate, chars, String::kNormalString, size);
delete[] chars;
return result;
}
@@ -1160,7 +1178,7 @@
v8::Local<v8::Context>::New(isolate, evaluation_context_);
v8::Context::Scope context_scope(context);
PerIsolateData::RealmScope realm_scope(PerIsolateData::Get(isolate));
- Handle<String> name = String::New("(d8)");
+ Handle<String> name = String::NewFromUtf8(isolate, "(d8)");
LineEditor* console = LineEditor::Get();
printf("V8 version %s [console: %s]\n", V8::GetVersion(), console->name());
console->Open(isolate);
@@ -1229,7 +1247,8 @@
Shell::Exit(1);
}
- Shell::ExecuteString(isolate_, str, String::New(filename), false, false);
+ Shell::ExecuteString(
+ isolate_, str, String::NewFromUtf8(isolate_, filename), false, false);
}
ptr = next_line;
@@ -1253,8 +1272,8 @@
if (strcmp(arg, "-e") == 0 && i + 1 < end_offset_) {
// Execute argument given to -e option directly.
HandleScope handle_scope(isolate);
- Handle<String> file_name = String::New("unnamed");
- Handle<String> source = String::New(argv_[i + 1]);
+ Handle<String> file_name = String::NewFromUtf8(isolate, "unnamed");
+ Handle<String> source = String::NewFromUtf8(isolate, argv_[i + 1]);
if (!Shell::ExecuteString(isolate, source, file_name, false, true)) {
exception_was_thrown = true;
break;
@@ -1265,7 +1284,7 @@
} else {
// Use all other arguments as names of files to load and run.
HandleScope handle_scope(isolate);
- Handle<String> file_name = String::New(arg);
+ Handle<String> file_name = String::NewFromUtf8(isolate, arg);
Handle<String> source = ReadFile(isolate, arg);
if (source.IsEmpty()) {
printf("Error reading '%s'\n", arg);
@@ -1287,7 +1306,8 @@
int size;
char* chars = ReadChars(isolate, name, &size);
if (chars == NULL) return Handle<String>();
- Handle<String> result = String::New(chars, size);
+ Handle<String> result =
+ String::NewFromUtf8(isolate, chars, String::kNormalString, size);
delete[] chars;
return result;
}
diff --git a/src/d8.h b/src/d8.h
index 761276e..3935200 100644
--- a/src/d8.h
+++ b/src/d8.h
@@ -377,7 +377,8 @@
static void MakeDirectory(const v8::FunctionCallbackInfo<v8::Value>& args);
static void RemoveDirectory(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void AddOSMethods(Handle<ObjectTemplate> os_template);
+ static void AddOSMethods(v8::Isolate* isolate,
+ Handle<ObjectTemplate> os_template);
static const char* kPrompt;
static ShellOptions options;
diff --git a/src/debug.cc b/src/debug.cc
index 6a8df7a..f3c3764 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -709,7 +709,7 @@
script_cache->collected_scripts_.Add(id);
// Clear the weak handle.
- obj->Dispose();
+ obj->Reset();
}
@@ -3071,6 +3071,7 @@
Handle<JSObject> exec_state,
Handle<JSObject> event_data,
bool auto_continue) {
+ v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(isolate_);
HandleScope scope(isolate_);
if (!isolate_->debug()->Load()) return;
@@ -3131,8 +3132,8 @@
{
v8::Local<v8::Object> api_exec_state =
v8::Utils::ToLocal(Handle<JSObject>::cast(exec_state));
- v8::Local<v8::String> fun_name =
- v8::String::New("debugCommandProcessor");
+ v8::Local<v8::String> fun_name = v8::String::NewFromUtf8(
+ isolate, "debugCommandProcessor");
v8::Local<v8::Function> fun =
v8::Local<v8::Function>::Cast(api_exec_state->Get(fun_name));
@@ -3179,11 +3180,12 @@
v8::Local<v8::Function> fun;
v8::Local<v8::Value> request;
v8::TryCatch try_catch;
- fun_name = v8::String::New("processDebugRequest");
+ fun_name = v8::String::NewFromUtf8(isolate, "processDebugRequest");
fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name));
- request = v8::String::New(command.text().start(),
- command.text().length());
+ request = v8::String::NewFromTwoByte(isolate, command.text().start(),
+ v8::String::kNormalString,
+ command.text().length());
static const int kArgc = 1;
v8::Handle<Value> argv[kArgc] = { request };
v8::Local<v8::Value> response_val = fun->Call(cmd_processor, kArgc, argv);
@@ -3195,7 +3197,7 @@
if (!response_val->IsUndefined()) {
response = v8::Local<v8::String>::Cast(response_val);
} else {
- response = v8::String::New("");
+ response = v8::String::NewFromUtf8(isolate, "");
}
// Log the JSON request/response.
@@ -3205,7 +3207,7 @@
}
// Get the running state.
- fun_name = v8::String::New("isRunning");
+ fun_name = v8::String::NewFromUtf8(isolate, "isRunning");
fun = v8::Local<v8::Function>::Cast(cmd_processor->Get(fun_name));
static const int kArgc = 1;
v8::Handle<Value> argv[kArgc] = { response };
diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc
index e39c345..077337f 100644
--- a/src/deoptimizer.cc
+++ b/src/deoptimizer.cc
@@ -1649,8 +1649,7 @@
output_frame->SetPc(reinterpret_cast<intptr_t>(
trampoline->instruction_start()));
output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
- Code* notify_failure =
- isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
+ Code* notify_failure = NotifyStubFailureBuiltin();
output_frame->SetContinuation(
reinterpret_cast<intptr_t>(notify_failure->entry()));
}
diff --git a/src/deoptimizer.h b/src/deoptimizer.h
index 52e4e24..f518546 100644
--- a/src/deoptimizer.h
+++ b/src/deoptimizer.h
@@ -406,6 +406,10 @@
// at the dynamic alignment state slot inside the frame.
bool HasAlignmentPadding(JSFunction* function);
+ // Select the version of NotifyStubFailure builtin that either saves or
+ // doesn't save the double registers depending on CPU features.
+ Code* NotifyStubFailureBuiltin();
+
Isolate* isolate_;
JSFunction* function_;
Code* compiled_code_;
diff --git a/src/extensions/externalize-string-extension.cc b/src/extensions/externalize-string-extension.cc
index 9fdb194..a86ec66 100644
--- a/src/extensions/externalize-string-extension.cc
+++ b/src/extensions/externalize-string-extension.cc
@@ -75,7 +75,8 @@
void ExternalizeStringExtension::Externalize(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() < 1 || !args[0]->IsString()) {
- args.GetIsolate()->ThrowException(v8::String::New(
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(),
"First parameter to externalizeString() must be a string."));
return;
}
@@ -84,7 +85,8 @@
if (args[1]->IsBoolean()) {
force_two_byte = args[1]->BooleanValue();
} else {
- args.GetIsolate()->ThrowException(v8::String::New(
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(),
"Second parameter to externalizeString() must be a boolean."));
return;
}
@@ -92,7 +94,8 @@
bool result = false;
Handle<String> string = Utils::OpenHandle(*args[0].As<v8::String>());
if (string->IsExternalString()) {
- args.GetIsolate()->ThrowException(v8::String::New(
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(),
"externalizeString() can't externalize twice."));
return;
}
@@ -120,8 +123,8 @@
if (!result) delete resource;
}
if (!result) {
- args.GetIsolate()->ThrowException(
- v8::String::New("externalizeString() failed."));
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(), "externalizeString() failed."));
return;
}
}
@@ -130,7 +133,8 @@
void ExternalizeStringExtension::IsAscii(
const v8::FunctionCallbackInfo<v8::Value>& args) {
if (args.Length() != 1 || !args[0]->IsString()) {
- args.GetIsolate()->ThrowException(v8::String::New(
+ args.GetIsolate()->ThrowException(v8::String::NewFromUtf8(
+ args.GetIsolate(),
"isAsciiString() requires a single string argument."));
return;
}
diff --git a/src/extensions/statistics-extension.cc b/src/extensions/statistics-extension.cc
index 586b2e3..431a156 100644
--- a/src/extensions/statistics-extension.cc
+++ b/src/extensions/statistics-extension.cc
@@ -41,27 +41,30 @@
}
-static void AddCounter(v8::Local<v8::Object> object,
+static void AddCounter(v8::Isolate* isolate,
+ v8::Local<v8::Object> object,
StatsCounter* counter,
const char* name) {
if (counter->Enabled()) {
- object->Set(v8::String::New(name),
+ object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(*counter->GetInternalPointer()));
}
}
-static void AddNumber(v8::Local<v8::Object> object,
+static void AddNumber(v8::Isolate* isolate,
+ v8::Local<v8::Object> object,
intptr_t value,
const char* name) {
- object->Set(v8::String::New(name),
+ object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(static_cast<double>(value)));
}
-static void AddNumber64(v8::Local<v8::Object> object,
+static void AddNumber64(v8::Isolate* isolate,
+ v8::Local<v8::Object> object,
int64_t value,
const char* name) {
- object->Set(v8::String::New(name),
+ object->Set(v8::String::NewFromUtf8(isolate, name),
v8::Number::New(static_cast<double>(value)));
}
@@ -81,79 +84,87 @@
v8::Local<v8::Object> result = v8::Object::New();
#define ADD_COUNTER(name, caption) \
- AddCounter(result, counters->name(), #name);
+ AddCounter(args.GetIsolate(), result, counters->name(), #name);
STATS_COUNTER_LIST_1(ADD_COUNTER)
STATS_COUNTER_LIST_2(ADD_COUNTER)
#undef ADD_COUNTER
-#define ADD_COUNTER(name) \
- AddCounter(result, counters->count_of_##name(), "count_of_" #name); \
- AddCounter(result, counters->size_of_##name(), "size_of_" #name);
+#define ADD_COUNTER(name) \
+ AddCounter(args.GetIsolate(), result, counters->count_of_##name(), \
+ "count_of_" #name); \
+ AddCounter(args.GetIsolate(), result, counters->size_of_##name(), \
+ "size_of_" #name);
INSTANCE_TYPE_LIST(ADD_COUNTER)
#undef ADD_COUNTER
-#define ADD_COUNTER(name) \
- AddCounter(result, counters->count_of_CODE_TYPE_##name(), \
- "count_of_CODE_TYPE_" #name); \
- AddCounter(result, counters->size_of_CODE_TYPE_##name(), \
+#define ADD_COUNTER(name) \
+ AddCounter(args.GetIsolate(), result, counters->count_of_CODE_TYPE_##name(), \
+ "count_of_CODE_TYPE_" #name); \
+ AddCounter(args.GetIsolate(), result, counters->size_of_CODE_TYPE_##name(), \
"size_of_CODE_TYPE_" #name);
CODE_KIND_LIST(ADD_COUNTER)
#undef ADD_COUNTER
-#define ADD_COUNTER(name) \
- AddCounter(result, counters->count_of_FIXED_ARRAY_##name(), \
- "count_of_FIXED_ARRAY_" #name); \
- AddCounter(result, counters->size_of_FIXED_ARRAY_##name(), \
+#define ADD_COUNTER(name) \
+ AddCounter(args.GetIsolate(), result, \
+ counters->count_of_FIXED_ARRAY_##name(), \
+ "count_of_FIXED_ARRAY_" #name); \
+ AddCounter(args.GetIsolate(), result, \
+ counters->size_of_FIXED_ARRAY_##name(), \
"size_of_FIXED_ARRAY_" #name);
FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADD_COUNTER)
#undef ADD_COUNTER
- AddNumber(result, isolate->memory_allocator()->Size(),
+ AddNumber(args.GetIsolate(), result, isolate->memory_allocator()->Size(),
"total_committed_bytes");
- AddNumber(result, heap->new_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->new_space()->Size(),
"new_space_live_bytes");
- AddNumber(result, heap->new_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->new_space()->Available(),
"new_space_available_bytes");
- AddNumber(result, heap->new_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result, heap->new_space()->CommittedMemory(),
"new_space_commited_bytes");
- AddNumber(result, heap->old_pointer_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->old_pointer_space()->Size(),
"old_pointer_space_live_bytes");
- AddNumber(result, heap->old_pointer_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->old_pointer_space()->Available(),
"old_pointer_space_available_bytes");
- AddNumber(result, heap->old_pointer_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
+ heap->old_pointer_space()->CommittedMemory(),
"old_pointer_space_commited_bytes");
- AddNumber(result, heap->old_data_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->old_data_space()->Size(),
"old_data_space_live_bytes");
- AddNumber(result, heap->old_data_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->old_data_space()->Available(),
"old_data_space_available_bytes");
- AddNumber(result, heap->old_data_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
+ heap->old_data_space()->CommittedMemory(),
"old_data_space_commited_bytes");
- AddNumber(result, heap->code_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->code_space()->Size(),
"code_space_live_bytes");
- AddNumber(result, heap->code_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->code_space()->Available(),
"code_space_available_bytes");
- AddNumber(result, heap->code_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result, heap->code_space()->CommittedMemory(),
"code_space_commited_bytes");
- AddNumber(result, heap->cell_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->cell_space()->Size(),
"cell_space_live_bytes");
- AddNumber(result, heap->cell_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->cell_space()->Available(),
"cell_space_available_bytes");
- AddNumber(result, heap->cell_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result, heap->cell_space()->CommittedMemory(),
"cell_space_commited_bytes");
- AddNumber(result, heap->property_cell_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->property_cell_space()->Size(),
"property_cell_space_live_bytes");
- AddNumber(result, heap->property_cell_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->property_cell_space()->Available(),
"property_cell_space_available_bytes");
- AddNumber(result, heap->property_cell_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result,
+ heap->property_cell_space()->CommittedMemory(),
"property_cell_space_commited_bytes");
- AddNumber(result, heap->lo_space()->Size(),
+ AddNumber(args.GetIsolate(), result, heap->lo_space()->Size(),
"lo_space_live_bytes");
- AddNumber(result, heap->lo_space()->Available(),
+ AddNumber(args.GetIsolate(), result, heap->lo_space()->Available(),
"lo_space_available_bytes");
- AddNumber(result, heap->lo_space()->CommittedMemory(),
+ AddNumber(args.GetIsolate(), result, heap->lo_space()->CommittedMemory(),
"lo_space_commited_bytes");
- AddNumber64(result, heap->amount_of_external_allocated_memory(),
+ AddNumber64(args.GetIsolate(), result,
+ heap->amount_of_external_allocated_memory(),
"amount_of_external_allocated_memory");
args.GetReturnValue().Set(result);
}
diff --git a/src/flag-definitions.h b/src/flag-definitions.h
index 1c95885..61e545f 100644
--- a/src/flag-definitions.h
+++ b/src/flag-definitions.h
@@ -785,6 +785,10 @@
DEFINE_string(logfile, "v8.log", "Specify the name of the log file.")
DEFINE_bool(logfile_per_isolate, true, "Separate log files for each isolate.")
DEFINE_bool(ll_prof, false, "Enable low-level linux profiler.")
+DEFINE_bool(perf_basic_prof, false,
+ "Enable perf linux profiler (basic support).")
+DEFINE_bool(perf_jit_prof, false,
+ "Enable perf linux profiler (experimental annotate support).")
DEFINE_string(gc_fake_mmap, "/tmp/__v8_gc__",
"Specify the name of the file for fake gc mmap used in ll_prof")
DEFINE_bool(log_internal_timer_events, false, "Time internal events.")
diff --git a/src/globals.h b/src/globals.h
index 1db48a1..db80a7e 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -251,9 +251,6 @@
const int kDoubleSizeLog2 = 3;
-// Size of the state of a the random number generator.
-const int kRandomStateSize = 2 * kIntSize;
-
#if V8_HOST_ARCH_64_BIT
const int kPointerSizeLog2 = 3;
const intptr_t kIntptrSignBit = V8_INT64_C(0x8000000000000000);
diff --git a/src/harmony-array.js b/src/harmony-array.js
index e440299..a9cc3b8 100644
--- a/src/harmony-array.js
+++ b/src/harmony-array.js
@@ -121,4 +121,4 @@
));
}
-HarmonyArrayExtendArrayPrototype();
\ No newline at end of file
+HarmonyArrayExtendArrayPrototype();
diff --git a/src/harmony-string.js b/src/harmony-string.js
index a5c6f4e..8e4b9a4 100644
--- a/src/harmony-string.js
+++ b/src/harmony-string.js
@@ -151,4 +151,4 @@
));
}
-ExtendStringPrototype();
\ No newline at end of file
+ExtendStringPrototype();
diff --git a/src/heap-snapshot-generator-inl.h b/src/heap-snapshot-generator-inl.h
index 1a878c6..43002d2 100644
--- a/src/heap-snapshot-generator-inl.h
+++ b/src/heap-snapshot-generator-inl.h
@@ -85,4 +85,3 @@
} } // namespace v8::internal
#endif // V8_HEAP_SNAPSHOT_GENERATOR_INL_H_
-
diff --git a/src/heap-snapshot-generator.h b/src/heap-snapshot-generator.h
index b8199ba..c69d5e5 100644
--- a/src/heap-snapshot-generator.h
+++ b/src/heap-snapshot-generator.h
@@ -704,4 +704,3 @@
} } // namespace v8::internal
#endif // V8_HEAP_SNAPSHOT_GENERATOR_H_
-
diff --git a/src/heap.cc b/src/heap.cc
index b5fe184..f28c926 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -7816,7 +7816,13 @@
void ExternalStringTable::TearDown() {
+ for (int i = 0; i < new_space_strings_.length(); ++i) {
+ heap_->FinalizeExternalString(ExternalString::cast(new_space_strings_[i]));
+ }
new_space_strings_.Free();
+ for (int i = 0; i < old_space_strings_.length(); ++i) {
+ heap_->FinalizeExternalString(ExternalString::cast(old_space_strings_[i]));
+ }
old_space_strings_.Free();
}
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 73c1d7d..fba23fa 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -155,7 +155,6 @@
V(Parameter) \
V(Power) \
V(PushArgument) \
- V(Random) \
V(RegExpLiteral) \
V(Return) \
V(Ror) \
@@ -1435,11 +1434,11 @@
class HDeoptimize V8_FINAL : public HTemplateControlInstruction<1, 0> {
public:
- static HInstruction* New(Zone* zone,
- HValue* context,
- const char* reason,
- Deoptimizer::BailoutType type,
- HBasicBlock* unreachable_continuation) {
+ static HDeoptimize* New(Zone* zone,
+ HValue* context,
+ const char* reason,
+ Deoptimizer::BailoutType type,
+ HBasicBlock* unreachable_continuation) {
return new(zone) HDeoptimize(reason, type, unreachable_continuation);
}
@@ -4724,28 +4723,6 @@
};
-class HRandom V8_FINAL : public HTemplateInstruction<1> {
- public:
- DECLARE_INSTRUCTION_FACTORY_P1(HRandom, HValue*);
-
- HValue* global_object() { return OperandAt(0); }
-
- virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
- return Representation::Tagged();
- }
-
- DECLARE_CONCRETE_INSTRUCTION(Random)
-
- private:
- explicit HRandom(HValue* global_object) {
- SetOperandAt(0, global_object);
- set_representation(Representation::Double());
- }
-
- virtual bool IsDeletable() const V8_OVERRIDE { return true; }
-};
-
-
class HAdd V8_FINAL : public HArithmeticBinaryOperation {
public:
static HInstruction* New(Zone* zone,
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index fd93ce3..3e08b69 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -1195,7 +1195,7 @@
HValue* reference = Add<HConstant>(ExternalReference(counter));
HValue* old_value = Add<HLoadNamedField>(reference,
HObjectAccess::ForCounter());
- HValue* new_value = Add<HAdd>(old_value, graph()->GetConstant1());
+ HValue* new_value = AddUncasted<HAdd>(old_value, graph()->GetConstant1());
new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow
Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(),
new_value);
@@ -1539,7 +1539,7 @@
static_cast<HValue*>(NULL),
FAST_SMI_ELEMENTS);
- HValue* mask = Add<HSub>(capacity, graph()->GetConstant1());
+ HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1());
mask->ChangeRepresentation(Representation::Integer32());
mask->ClearFlag(HValue::kCanOverflow);
@@ -1571,8 +1571,8 @@
// contains two elements (number and string) for each cache entry.
HValue* mask = AddLoadFixedArrayLength(number_string_cache);
mask->set_type(HType::Smi());
- mask = Add<HSar>(mask, graph()->GetConstant1());
- mask = Add<HSub>(mask, graph()->GetConstant1());
+ mask = AddUncasted<HSar>(mask, graph()->GetConstant1());
+ mask = AddUncasted<HSub>(mask, graph()->GetConstant1());
// Check whether object is a smi.
IfBuilder if_objectissmi(this);
@@ -1716,7 +1716,8 @@
HValue* index = loop.BeginBody(graph()->GetConstant0(), length, Token::LT);
{
HValue* src_index = AddUncasted<HAdd>(src_offset, index);
- HValue* value = Add<HSeqStringGetChar>(src_encoding, src, src_index);
+ HValue* value =
+ AddUncasted<HSeqStringGetChar>(src_encoding, src, src_index);
HValue* dst_index = AddUncasted<HAdd>(dst_offset, index);
Add<HSeqStringSetChar>(dst_encoding, dst, dst_index, value);
}
@@ -1733,248 +1734,237 @@
HValue* right_length = Add<HLoadNamedField>(
right, HObjectAccess::ForStringLength());
- // Check if we concatenated the strings here, or if we have to resort to the
- // runtime function.
- HIfContinuation handled(graph()->CreateBasicBlock(),
- graph()->CreateBasicBlock());
+ // Compute the combined string length. If the result is larger than the max
+ // supported string length, we bailout to the runtime. This is done implicitly
+ // when converting the result back to a smi in case the max string length
+ // equals the max smi valie. Otherwise, for platforms with 32-bit smis, we do
+ HValue* length = AddUncasted<HAdd>(left_length, right_length);
+ STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
+ if (String::kMaxLength != Smi::kMaxValue) {
+ IfBuilder if_nooverflow(this);
+ if_nooverflow.If<HCompareNumericAndBranch>(
+ length, Add<HConstant>(String::kMaxLength), Token::LTE);
+ if_nooverflow.Then();
+ if_nooverflow.ElseDeopt("String length exceeds limit");
+ }
- // Check if both parameters do not exceed half the max string length, because
- // exceptionally long strings should be handled in the runtime. Unfortunately
- // we cannot actually check whether the combined length of both strings
- // exceeds String::kMaxLength (because of unclear results from the
- // representation inference phase), so we use a pessimistic approach here
- // instead, checking that the length of either substring does not exceed half
- // of String::kMaxLength.
- HConstant* max_length = Add<HConstant>(String::kMaxLength / 2);
- IfBuilder if_nooverflow(this);
- if_nooverflow.If<HCompareNumericAndBranch>(
- left_length, max_length, Token::LTE);
- if_nooverflow.AndIf<HCompareNumericAndBranch>(
- right_length, max_length, Token::LTE);
- if_nooverflow.Then();
+ // Determine the string instance types.
+ HLoadNamedField* left_instance_type = Add<HLoadNamedField>(
+ Add<HLoadNamedField>(left, HObjectAccess::ForMap()),
+ HObjectAccess::ForMapInstanceType());
+ HLoadNamedField* right_instance_type = Add<HLoadNamedField>(
+ Add<HLoadNamedField>(right, HObjectAccess::ForMap()),
+ HObjectAccess::ForMapInstanceType());
+
+ // Compute difference of instance types.
+ HValue* xored_instance_types = AddUncasted<HBitwise>(
+ Token::BIT_XOR, left_instance_type, right_instance_type);
+
+ // Check if we should create a cons string.
+ IfBuilder if_createcons(this);
+ if_createcons.If<HCompareNumericAndBranch>(
+ length, Add<HConstant>(ConsString::kMinLength), Token::GTE);
+ if_createcons.Then();
{
- // Determine the string instance types.
- HLoadNamedField* left_instance_type = Add<HLoadNamedField>(
- Add<HLoadNamedField>(left, HObjectAccess::ForMap()),
- HObjectAccess::ForMapInstanceType());
- HLoadNamedField* right_instance_type = Add<HLoadNamedField>(
- Add<HLoadNamedField>(right, HObjectAccess::ForMap()),
- HObjectAccess::ForMapInstanceType());
+ // Allocate the cons string object. HAllocate does not care whether we
+ // pass CONS_STRING_TYPE or CONS_ASCII_STRING_TYPE here, so we just use
+ // CONS_STRING_TYPE here. Below we decide whether the cons string is
+ // one-byte or two-byte and set the appropriate map.
+ HAllocate* string = Add<HAllocate>(Add<HConstant>(ConsString::kSize),
+ HType::String(), pretenure_flag,
+ CONS_STRING_TYPE);
- // Compute difference of instance types.
- HValue* xored_instance_types = AddUncasted<HBitwise>(
- Token::BIT_XOR, left_instance_type, right_instance_type);
+ // Compute the intersection of instance types.
+ HValue* anded_instance_types = AddUncasted<HBitwise>(
+ Token::BIT_AND, left_instance_type, right_instance_type);
- // Compute the length of the resulting string.
- HValue* length = AddUncasted<HAdd>(left_length, right_length);
-
- // Check if we should create a cons string.
- IfBuilder if_createcons(this);
- if_createcons.If<HCompareNumericAndBranch>(
- length, Add<HConstant>(ConsString::kMinLength), Token::GTE);
- if_createcons.Then();
+ // We create a one-byte cons string if
+ // 1. both strings are one-byte, or
+ // 2. at least one of the strings is two-byte, but happens to contain only
+ // one-byte characters.
+ // To do this, we check
+ // 1. if both strings are one-byte, or if the one-byte data hint is set in
+ // both strings, or
+ // 2. if one of the strings has the one-byte data hint set and the other
+ // string is one-byte.
+ IfBuilder if_onebyte(this);
+ STATIC_ASSERT(kOneByteStringTag != 0);
+ STATIC_ASSERT(kOneByteDataHintMask != 0);
+ if_onebyte.If<HCompareNumericAndBranch>(
+ AddUncasted<HBitwise>(
+ Token::BIT_AND, anded_instance_types,
+ Add<HConstant>(static_cast<int32_t>(
+ kStringEncodingMask | kOneByteDataHintMask))),
+ graph()->GetConstant0(), Token::NE);
+ if_onebyte.Or();
+ STATIC_ASSERT(kOneByteStringTag != 0 &&
+ kOneByteDataHintTag != 0 &&
+ kOneByteDataHintTag != kOneByteStringTag);
+ if_onebyte.If<HCompareNumericAndBranch>(
+ AddUncasted<HBitwise>(
+ Token::BIT_AND, xored_instance_types,
+ Add<HConstant>(static_cast<int32_t>(
+ kOneByteStringTag | kOneByteDataHintTag))),
+ Add<HConstant>(static_cast<int32_t>(
+ kOneByteStringTag | kOneByteDataHintTag)), Token::EQ);
+ if_onebyte.Then();
{
- // Allocate the cons string object. HAllocate does not care whether we
- // pass CONS_STRING_TYPE or CONS_ASCII_STRING_TYPE here, so we just use
- // CONS_STRING_TYPE here. Below we decide whether the cons string is
- // one-byte or two-byte and set the appropriate map.
- HAllocate* string = Add<HAllocate>(Add<HConstant>(ConsString::kSize),
- HType::String(), pretenure_flag,
- CONS_STRING_TYPE);
+ // We can safely skip the write barrier for storing the map here.
+ Handle<Map> map = isolate()->factory()->cons_ascii_string_map();
+ AddStoreMapConstantNoWriteBarrier(string, map);
+ }
+ if_onebyte.Else();
+ {
+ // We can safely skip the write barrier for storing the map here.
+ Handle<Map> map = isolate()->factory()->cons_string_map();
+ AddStoreMapConstantNoWriteBarrier(string, map);
+ }
+ if_onebyte.End();
- // Compute the intersection of instance types.
- HValue* anded_instance_types = AddUncasted<HBitwise>(
- Token::BIT_AND, left_instance_type, right_instance_type);
+ // Initialize the cons string fields.
+ Add<HStoreNamedField>(string, HObjectAccess::ForStringHashField(),
+ Add<HConstant>(String::kEmptyHashField));
+ Add<HStoreNamedField>(string, HObjectAccess::ForStringLength(), length);
+ Add<HStoreNamedField>(string, HObjectAccess::ForConsStringFirst(), left);
+ Add<HStoreNamedField>(string, HObjectAccess::ForConsStringSecond(),
+ right);
- // We create a one-byte cons string if
- // 1. both strings are one-byte, or
- // 2. at least one of the strings is two-byte, but happens to contain only
- // one-byte characters.
- // To do this, we check
- // 1. if both strings are one-byte, or if the one-byte data hint is set in
- // both strings, or
- // 2. if one of the strings has the one-byte data hint set and the other
- // string is one-byte.
+ // Count the native string addition.
+ AddIncrementCounter(isolate()->counters()->string_add_native());
+
+ // Cons string is result.
+ Push(string);
+ }
+ if_createcons.Else();
+ {
+ // Compute union of instance types.
+ HValue* ored_instance_types = AddUncasted<HBitwise>(
+ Token::BIT_OR, left_instance_type, right_instance_type);
+
+ // Check if both strings have the same encoding and both are
+ // sequential.
+ IfBuilder if_sameencodingandsequential(this);
+ if_sameencodingandsequential.If<HCompareNumericAndBranch>(
+ AddUncasted<HBitwise>(
+ Token::BIT_AND, xored_instance_types,
+ Add<HConstant>(static_cast<int32_t>(kStringEncodingMask))),
+ graph()->GetConstant0(), Token::EQ);
+ if_sameencodingandsequential.And();
+ STATIC_ASSERT(kSeqStringTag == 0);
+ if_sameencodingandsequential.If<HCompareNumericAndBranch>(
+ AddUncasted<HBitwise>(
+ Token::BIT_AND, ored_instance_types,
+ Add<HConstant>(static_cast<int32_t>(kStringRepresentationMask))),
+ graph()->GetConstant0(), Token::EQ);
+ if_sameencodingandsequential.Then();
+ {
+ // Check if the result is a one-byte string.
IfBuilder if_onebyte(this);
STATIC_ASSERT(kOneByteStringTag != 0);
- STATIC_ASSERT(kOneByteDataHintMask != 0);
if_onebyte.If<HCompareNumericAndBranch>(
AddUncasted<HBitwise>(
- Token::BIT_AND, anded_instance_types,
- Add<HConstant>(static_cast<int32_t>(
- kStringEncodingMask | kOneByteDataHintMask))),
+ Token::BIT_AND, ored_instance_types,
+ Add<HConstant>(static_cast<int32_t>(kStringEncodingMask))),
graph()->GetConstant0(), Token::NE);
- if_onebyte.Or();
- STATIC_ASSERT(kOneByteStringTag != 0 &&
- kOneByteDataHintTag != 0 &&
- kOneByteDataHintTag != kOneByteStringTag);
- if_onebyte.If<HCompareNumericAndBranch>(
- AddUncasted<HBitwise>(
- Token::BIT_AND, xored_instance_types,
- Add<HConstant>(static_cast<int32_t>(
- kOneByteStringTag | kOneByteDataHintTag))),
- Add<HConstant>(static_cast<int32_t>(
- kOneByteStringTag | kOneByteDataHintTag)), Token::EQ);
if_onebyte.Then();
{
- // We can safely skip the write barrier for storing the map here.
- Handle<Map> map = isolate()->factory()->cons_ascii_string_map();
+ // Calculate the number of bytes needed for the characters in the
+ // string while observing object alignment.
+ HValue* size = BuildSeqStringSizeFor(
+ length, String::ONE_BYTE_ENCODING);
+
+ // Allocate the ASCII string object.
+ Handle<Map> map = isolate()->factory()->ascii_string_map();
+ HAllocate* string = Add<HAllocate>(size, HType::String(),
+ pretenure_flag, ASCII_STRING_TYPE);
+ string->set_known_initial_map(map);
+
+ // We can safely skip the write barrier for storing map here.
AddStoreMapConstantNoWriteBarrier(string, map);
+
+ // Length must be stored into the string before we copy characters to
+ // make debug verification code happy.
+ Add<HStoreNamedField>(string, HObjectAccess::ForStringLength(),
+ length);
+
+ // Copy bytes from the left string.
+ BuildCopySeqStringChars(
+ left, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
+ string, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
+ left_length);
+
+ // Copy bytes from the right string.
+ BuildCopySeqStringChars(
+ right, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
+ string, left_length, String::ONE_BYTE_ENCODING,
+ right_length);
+
+ // Count the native string addition.
+ AddIncrementCounter(isolate()->counters()->string_add_native());
+
+ // Return the string.
+ Push(string);
}
if_onebyte.Else();
{
- // We can safely skip the write barrier for storing the map here.
- Handle<Map> map = isolate()->factory()->cons_string_map();
+ // Calculate the number of bytes needed for the characters in the
+ // string while observing object alignment.
+ HValue* size = BuildSeqStringSizeFor(
+ length, String::TWO_BYTE_ENCODING);
+
+ // Allocate the two-byte string object.
+ Handle<Map> map = isolate()->factory()->string_map();
+ HAllocate* string = Add<HAllocate>(size, HType::String(),
+ pretenure_flag, STRING_TYPE);
+ string->set_known_initial_map(map);
+
+ // We can safely skip the write barrier for storing map here.
AddStoreMapConstantNoWriteBarrier(string, map);
+
+ // Length must be stored into the string before we copy characters to
+ // make debug verification code happy.
+ Add<HStoreNamedField>(string, HObjectAccess::ForStringLength(),
+ length);
+
+ // Copy bytes from the left string.
+ BuildCopySeqStringChars(
+ left, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
+ string, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
+ left_length);
+
+ // Copy bytes from the right string.
+ BuildCopySeqStringChars(
+ right, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
+ string, left_length, String::TWO_BYTE_ENCODING,
+ right_length);
+
+ // Return the string.
+ Push(string);
}
if_onebyte.End();
- // Initialize the cons string fields.
+ // Initialize the (common) string fields.
+ HValue* string = Pop();
Add<HStoreNamedField>(string, HObjectAccess::ForStringHashField(),
Add<HConstant>(String::kEmptyHashField));
- Add<HStoreNamedField>(string, HObjectAccess::ForStringLength(), length);
- Add<HStoreNamedField>(string, HObjectAccess::ForConsStringFirst(), left);
- Add<HStoreNamedField>(string, HObjectAccess::ForConsStringSecond(),
- right);
- // Cons string is result.
+ // Count the native string addition.
+ AddIncrementCounter(isolate()->counters()->string_add_native());
+
Push(string);
}
- if_createcons.Else();
+ if_sameencodingandsequential.Else();
{
- // Compute union of instance types.
- HValue* ored_instance_types = AddUncasted<HBitwise>(
- Token::BIT_OR, left_instance_type, right_instance_type);
-
- // Check if both strings have the same encoding and both are
- // sequential.
- IfBuilder if_sameencodingandsequential(this);
- if_sameencodingandsequential.If<HCompareNumericAndBranch>(
- AddUncasted<HBitwise>(
- Token::BIT_AND, xored_instance_types,
- Add<HConstant>(static_cast<int32_t>(kStringEncodingMask))),
- graph()->GetConstant0(), Token::EQ);
- if_sameencodingandsequential.And();
- STATIC_ASSERT(kSeqStringTag == 0);
- if_sameencodingandsequential.If<HCompareNumericAndBranch>(
- AddUncasted<HBitwise>(
- Token::BIT_AND, ored_instance_types,
- Add<HConstant>(static_cast<int32_t>(kStringRepresentationMask))),
- graph()->GetConstant0(), Token::EQ);
- if_sameencodingandsequential.Then();
- {
- // Check if the result is a one-byte string.
- IfBuilder if_onebyte(this);
- STATIC_ASSERT(kOneByteStringTag != 0);
- if_onebyte.If<HCompareNumericAndBranch>(
- AddUncasted<HBitwise>(
- Token::BIT_AND, ored_instance_types,
- Add<HConstant>(static_cast<int32_t>(kStringEncodingMask))),
- graph()->GetConstant0(), Token::NE);
- if_onebyte.Then();
- {
- // Calculate the number of bytes needed for the characters in the
- // string while observing object alignment.
- HValue* size = BuildSeqStringSizeFor(
- length, String::ONE_BYTE_ENCODING);
-
- // Allocate the ASCII string object.
- Handle<Map> map = isolate()->factory()->ascii_string_map();
- HAllocate* string = Add<HAllocate>(size, HType::String(),
- pretenure_flag, ASCII_STRING_TYPE);
- string->set_known_initial_map(map);
-
- // We can safely skip the write barrier for storing map here.
- AddStoreMapConstantNoWriteBarrier(string, map);
-
- // Length must be stored into the string before we copy characters to
- // make debug verification code happy.
- Add<HStoreNamedField>(string, HObjectAccess::ForStringLength(),
- length);
-
- // Copy bytes from the left string.
- BuildCopySeqStringChars(
- left, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
- string, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
- left_length);
-
- // Copy bytes from the right string.
- BuildCopySeqStringChars(
- right, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
- string, left_length, String::ONE_BYTE_ENCODING,
- right_length);
-
- // Return the string.
- Push(string);
- }
- if_onebyte.Else();
- {
- // Calculate the number of bytes needed for the characters in the
- // string while observing object alignment.
- HValue* size = BuildSeqStringSizeFor(
- length, String::TWO_BYTE_ENCODING);
-
- // Allocate the two-byte string object.
- Handle<Map> map = isolate()->factory()->string_map();
- HAllocate* string = Add<HAllocate>(size, HType::String(),
- pretenure_flag, STRING_TYPE);
- string->set_known_initial_map(map);
-
- // We can safely skip the write barrier for storing map here.
- AddStoreMapConstantNoWriteBarrier(string, map);
-
- // Length must be stored into the string before we copy characters to
- // make debug verification code happy.
- Add<HStoreNamedField>(string, HObjectAccess::ForStringLength(),
- length);
-
- // Copy bytes from the left string.
- BuildCopySeqStringChars(
- left, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
- string, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
- left_length);
-
- // Copy bytes from the right string.
- BuildCopySeqStringChars(
- right, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
- string, left_length, String::TWO_BYTE_ENCODING,
- right_length);
-
- // Return the string.
- Push(string);
- }
- if_onebyte.End();
-
- // Initialize the (common) string fields.
- HValue* string = Pop();
- Add<HStoreNamedField>(string, HObjectAccess::ForStringHashField(),
- Add<HConstant>(String::kEmptyHashField));
- Push(string);
- }
- if_sameencodingandsequential.JoinContinuation(&handled);
+ // Fallback to the runtime to add the two strings.
+ Add<HPushArgument>(left);
+ Add<HPushArgument>(right);
+ Push(Add<HCallRuntime>(isolate()->factory()->empty_string(),
+ Runtime::FunctionForId(Runtime::kStringAdd),
+ 2));
}
- if_createcons.JoinContinuation(&handled);
+ if_sameencodingandsequential.End();
}
- if_nooverflow.JoinContinuation(&handled);
-
- // Check if the strings were concatenated successfully, otherwise fallback to
- // add the strings in the runtime.
- IfBuilder if_handled(this, &handled);
- if_handled.Then();
- {
- // Count the native string addition.
- AddIncrementCounter(isolate()->counters()->string_add_native());
- }
- if_handled.Else();
- {
- // Fallback to the runtime to add the two strings.
- Add<HPushArgument>(left);
- Add<HPushArgument>(right);
- Push(Add<HCallRuntime>(isolate()->factory()->empty_string(),
- Runtime::FunctionForId(Runtime::kStringAdd),
- 2));
- }
- if_handled.End();
+ if_createcons.End();
return Pop();
}
@@ -7486,16 +7476,6 @@
return true;
}
break;
- case kMathRandom:
- if (argument_count == 1 && check_type == RECEIVER_MAP_CHECK) {
- AddCheckConstantFunction(expr->holder(), receiver, receiver_map);
- Drop(1); // Receiver.
- HGlobalObject* global_object = Add<HGlobalObject>();
- HRandom* result = New<HRandom>(global_object);
- ast_context()->ReturnInstruction(result, expr->id());
- return true;
- }
- break;
case kMathMax:
case kMathMin:
if (argument_count == 3 && check_type == RECEIVER_MAP_CHECK) {
@@ -8619,8 +8599,7 @@
Handle<Type> left_type,
Handle<Type> right_type,
Handle<Type> result_type,
- Maybe<int> fixed_right_arg,
- bool binop_stub) {
+ Maybe<int> fixed_right_arg) {
Representation left_rep = Representation::FromType(left_type);
Representation right_rep = Representation::FromType(right_type);
@@ -8689,7 +8668,7 @@
return AddUncasted<HStringAdd>(left, right, STRING_ADD_CHECK_NONE);
}
- if (binop_stub) {
+ if (graph()->info()->IsStub()) {
left = EnforceNumberType(left, left_type);
right = EnforceNumberType(right, right_type);
}
@@ -8703,7 +8682,7 @@
// Only the stub is allowed to call into the runtime, since otherwise we would
// inline several instructions (including the two pushes) for every tagged
// operation in optimized code, which is more expensive, than a stub call.
- if (binop_stub && is_non_primitive) {
+ if (graph()->info()->IsStub() && is_non_primitive) {
HValue* function = AddLoadJSBuiltin(BinaryOpIC::TokenToJSBuiltin(op));
Add<HPushArgument>(left);
Add<HPushArgument>(right);
@@ -8778,7 +8757,7 @@
binop->set_observed_input_representation(1, left_rep);
binop->set_observed_input_representation(2, right_rep);
binop->initialize_output_representation(result_rep);
- if (binop_stub) {
+ if (graph()->info()->IsStub()) {
// Stub should not call into stub.
instr->SetFlag(HValue::kCannotBeTagged);
// And should truncate on HForceRepresentation already.
@@ -9868,14 +9847,6 @@
}
-// Fast support for Math.random().
-void HOptimizedGraphBuilder::GenerateRandomHeapNumber(CallRuntime* call) {
- HGlobalObject* global_object = Add<HGlobalObject>();
- HRandom* result = New<HRandom>(global_object);
- return ast_context()->ReturnInstruction(result, call->id());
-}
-
-
// Fast support for StringAdd.
void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) {
ASSERT_EQ(2, call->arguments()->length());
@@ -9883,7 +9854,8 @@
CHECK_ALIVE(VisitForValue(call->arguments()->at(1)));
HValue* right = Pop();
HValue* left = Pop();
- HInstruction* result = New<HStringAdd>(left, right, STRING_ADD_CHECK_BOTH);
+ HInstruction* result =
+ NewUncasted<HStringAdd>(left, right, STRING_ADD_CHECK_BOTH);
return ast_context()->ReturnInstruction(result, call->id());
}
@@ -10012,7 +9984,7 @@
ASSERT(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* value = Pop();
- HInstruction* result = New<HUnaryMathOperation>(value, kMathSqrt);
+ HInstruction* result = NewUncasted<HUnaryMathOperation>(value, kMathSqrt);
return ast_context()->ReturnInstruction(result, call->id());
}
diff --git a/src/hydrogen.h b/src/hydrogen.h
index d11fbc0..e0c5066 100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -1057,13 +1057,13 @@
HInstruction* NewUncasted() { return I::New(zone(), context()); }
template<class I>
- I* New() { return I::cast(NewUncasted<I>()); }
+ I* New() { return I::New(zone(), context()); }
template<class I>
HInstruction* AddUncasted() { return AddInstruction(NewUncasted<I>());}
template<class I>
- I* Add() { return I::cast(AddUncasted<I>());}
+ I* Add() { return AddInstructionTyped(New<I>());}
template<class I, class P1>
HInstruction* NewUncasted(P1 p1) {
@@ -1071,7 +1071,7 @@
}
template<class I, class P1>
- I* New(P1 p1) { return I::cast(NewUncasted<I>(p1)); }
+ I* New(P1 p1) { return I::New(zone(), context(), p1); }
template<class I, class P1>
HInstruction* AddUncasted(P1 p1) {
@@ -1085,7 +1085,12 @@
template<class I, class P1>
I* Add(P1 p1) {
- return I::cast(AddUncasted<I>(p1));
+ I* result = AddInstructionTyped(New<I>(p1));
+ // Specializations must have their parameters properly casted
+ // to avoid landing here.
+ ASSERT(!result->IsReturn() && !result->IsSimulate() &&
+ !result->IsDeoptimize());
+ return result;
}
template<class I, class P1, class P2>
@@ -1095,7 +1100,7 @@
template<class I, class P1, class P2>
I* New(P1 p1, P2 p2) {
- return I::cast(NewUncasted<I>(p1, p2));
+ return I::New(zone(), context(), p1, p2);
}
template<class I, class P1, class P2>
@@ -1109,7 +1114,11 @@
template<class I, class P1, class P2>
I* Add(P1 p1, P2 p2) {
- return I::cast(AddUncasted<I>(p1, p2));
+ I* result = AddInstructionTyped(New<I>(p1, p2));
+ // Specializations must have their parameters properly casted
+ // to avoid landing here.
+ ASSERT(!result->IsSimulate());
+ return result;
}
template<class I, class P1, class P2, class P3>
@@ -1119,7 +1128,7 @@
template<class I, class P1, class P2, class P3>
I* New(P1 p1, P2 p2, P3 p3) {
- return I::cast(NewUncasted<I>(p1, p2, p3));
+ return I::New(zone(), context(), p1, p2, p3);
}
template<class I, class P1, class P2, class P3>
@@ -1129,7 +1138,7 @@
template<class I, class P1, class P2, class P3>
I* Add(P1 p1, P2 p2, P3 p3) {
- return I::cast(AddUncasted<I>(p1, p2, p3));
+ return AddInstructionTyped(New<I>(p1, p2, p3));
}
template<class I, class P1, class P2, class P3, class P4>
@@ -1139,7 +1148,7 @@
template<class I, class P1, class P2, class P3, class P4>
I* New(P1 p1, P2 p2, P3 p3, P4 p4) {
- return I::cast(NewUncasted<I>(p1, p2, p3, p4));
+ return I::New(zone(), context(), p1, p2, p3, p4);
}
template<class I, class P1, class P2, class P3, class P4>
@@ -1149,7 +1158,7 @@
template<class I, class P1, class P2, class P3, class P4>
I* Add(P1 p1, P2 p2, P3 p3, P4 p4) {
- return I::cast(AddUncasted<I>(p1, p2, p3, p4));
+ return AddInstructionTyped(New<I>(p1, p2, p3, p4));
}
template<class I, class P1, class P2, class P3, class P4, class P5>
@@ -1159,7 +1168,7 @@
template<class I, class P1, class P2, class P3, class P4, class P5>
I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
- return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5));
+ return I::New(zone(), context(), p1, p2, p3, p4, p5);
}
template<class I, class P1, class P2, class P3, class P4, class P5>
@@ -1169,7 +1178,7 @@
template<class I, class P1, class P2, class P3, class P4, class P5>
I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) {
- return I::cast(AddUncasted<I>(p1, p2, p3, p4, p5));
+ return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5));
}
template<class I, class P1, class P2, class P3, class P4, class P5, class P6>
@@ -1179,7 +1188,7 @@
template<class I, class P1, class P2, class P3, class P4, class P5, class P6>
I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
- return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6));
+ return I::New(zone(), context(), p1, p2, p3, p4, p5, p6);
}
template<class I, class P1, class P2, class P3, class P4, class P5, class P6>
@@ -1189,7 +1198,7 @@
template<class I, class P1, class P2, class P3, class P4, class P5, class P6>
I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) {
- return I::cast(AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6)));
+ return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6));
}
template<class I, class P1, class P2, class P3, class P4,
@@ -1201,7 +1210,7 @@
template<class I, class P1, class P2, class P3, class P4,
class P5, class P6, class P7>
I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
- return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7));
+ return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7);
}
template<class I, class P1, class P2, class P3,
@@ -1213,8 +1222,7 @@
template<class I, class P1, class P2, class P3,
class P4, class P5, class P6, class P7>
I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) {
- return I::cast(AddInstruction(NewUncasted<I>(p1, p2, p3, p4,
- p5, p6, p7)));
+ return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7));
}
template<class I, class P1, class P2, class P3, class P4,
@@ -1227,7 +1235,7 @@
template<class I, class P1, class P2, class P3, class P4,
class P5, class P6, class P7, class P8>
I* New(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
- return I::cast(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8));
+ return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7, p8);
}
template<class I, class P1, class P2, class P3, class P4,
@@ -1240,8 +1248,7 @@
template<class I, class P1, class P2, class P3, class P4,
class P5, class P6, class P7, class P8>
I* Add(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) {
- return I::cast(
- AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8)));
+ return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8));
}
void AddSimulate(BailoutId id, RemovableSimulate removable = FIXED_SIMULATE);
@@ -1345,8 +1352,7 @@
Handle<Type> left_type,
Handle<Type> right_type,
Handle<Type> result_type,
- Maybe<int> fixed_right_arg,
- bool binop_stub = false);
+ Maybe<int> fixed_right_arg);
HLoadNamedField* AddLoadFixedArrayLength(HValue *object);
@@ -1743,6 +1749,11 @@
void PadEnvironmentForContinuation(HBasicBlock* from,
HBasicBlock* continuation);
+ template <class I>
+ I* AddInstructionTyped(I* instr) {
+ return I::cast(AddInstruction(instr));
+ }
+
CompilationInfo* info_;
HGraph* graph_;
HBasicBlock* current_block_;
@@ -1751,7 +1762,7 @@
template<>
-inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>(
+inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>(
const char* reason, Deoptimizer::BailoutType type) {
if (type == Deoptimizer::SOFT) {
isolate()->counters()->soft_deopts_requested()->Increment();
@@ -1771,14 +1782,14 @@
template<>
-inline HDeoptimize* HGraphBuilder::Add<HDeoptimize>(
+inline HInstruction* HGraphBuilder::AddUncasted<HDeoptimize>(
const char* reason, Deoptimizer::BailoutType type) {
- return static_cast<HDeoptimize*>(AddUncasted<HDeoptimize>(reason, type));
+ return Add<HDeoptimize>(reason, type);
}
template<>
-inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(
+inline HSimulate* HGraphBuilder::Add<HSimulate>(
BailoutId id,
RemovableSimulate removable) {
HSimulate* instr = current_block()->CreateSimulate(id, removable);
@@ -1788,13 +1799,20 @@
template<>
-inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) {
- return AddUncasted<HSimulate>(id, FIXED_SIMULATE);
+inline HSimulate* HGraphBuilder::Add<HSimulate>(
+ BailoutId id) {
+ return Add<HSimulate>(id, FIXED_SIMULATE);
}
template<>
-inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) {
+inline HInstruction* HGraphBuilder::AddUncasted<HSimulate>(BailoutId id) {
+ return Add<HSimulate>(id, FIXED_SIMULATE);
+}
+
+
+template<>
+inline HReturn* HGraphBuilder::Add<HReturn>(HValue* value) {
int num_parameters = graph()->info()->num_parameters();
HValue* params = AddUncasted<HConstant>(num_parameters);
HReturn* return_instruction = New<HReturn>(value, params);
@@ -1804,13 +1822,24 @@
template<>
-inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) {
- return AddUncasted<HReturn>(static_cast<HValue*>(value));
+inline HReturn* HGraphBuilder::Add<HReturn>(HConstant* value) {
+ return Add<HReturn>(static_cast<HValue*>(value));
+}
+
+template<>
+inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HValue* value) {
+ return Add<HReturn>(value);
}
template<>
-inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>(
+inline HInstruction* HGraphBuilder::AddUncasted<HReturn>(HConstant* value) {
+ return Add<HReturn>(value);
+}
+
+
+template<>
+inline HCallRuntime* HGraphBuilder::Add<HCallRuntime>(
Handle<String> name,
const Runtime::Function* c_function,
int argument_count) {
@@ -1827,11 +1856,25 @@
template<>
-inline HInstruction* HGraphBuilder::NewUncasted<HContext>() {
+inline HInstruction* HGraphBuilder::AddUncasted<HCallRuntime>(
+ Handle<String> name,
+ const Runtime::Function* c_function,
+ int argument_count) {
+ return Add<HCallRuntime>(name, c_function, argument_count);
+}
+
+
+template<>
+inline HContext* HGraphBuilder::New<HContext>() {
return HContext::New(zone());
}
+template<>
+inline HInstruction* HGraphBuilder::NewUncasted<HContext>() {
+ return New<HContext>();
+}
+
class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
public:
// A class encapsulating (lazily-allocated) break and continue blocks for
diff --git a/src/i18n.cc b/src/i18n.cc
index dbff6e5..80a739c 100644
--- a/src/i18n.cc
+++ b/src/i18n.cc
@@ -872,7 +872,7 @@
v8::Utils::OpenPersistent(object))->GetInternalField(0));
// Then dispose of the persistent handle to JS object.
- object->Dispose();
+ object->Reset();
}
@@ -936,7 +936,7 @@
v8::Utils::OpenPersistent(object))->GetInternalField(0));
// Then dispose of the persistent handle to JS object.
- object->Dispose();
+ object->Reset();
}
@@ -997,7 +997,7 @@
v8::Utils::OpenPersistent(object))->GetInternalField(0));
// Then dispose of the persistent handle to JS object.
- object->Dispose();
+ object->Reset();
}
@@ -1064,7 +1064,7 @@
v8::Utils::OpenPersistent(object))->GetInternalField(1));
// Then dispose of the persistent handle to JS object.
- object->Dispose();
+ object->Reset();
}
} } // namespace v8::internal
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
index e5e6ec5..32c3397 100644
--- a/src/ia32/builtins-ia32.cc
+++ b/src/ia32/builtins-ia32.cc
@@ -601,7 +601,8 @@
}
-void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
+static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
+ SaveFPRegsMode save_doubles) {
// Enter an internal frame.
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -610,7 +611,7 @@
// stubs that tail call the runtime on deopts passing their parameters in
// registers.
__ pushad();
- __ CallRuntime(Runtime::kNotifyStubFailure, 0);
+ __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles);
__ popad();
// Tear down internal frame.
}
@@ -620,6 +621,16 @@
}
+void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
+ Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
+}
+
+
+void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
+ Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
+}
+
+
static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
Deoptimizer::BailoutType type) {
{
diff --git a/src/ia32/deoptimizer-ia32.cc b/src/ia32/deoptimizer-ia32.cc
index e043aa4..5300dde 100644
--- a/src/ia32/deoptimizer-ia32.cc
+++ b/src/ia32/deoptimizer-ia32.cc
@@ -231,6 +231,13 @@
}
+Code* Deoptimizer::NotifyStubFailureBuiltin() {
+ Builtins::Name name = CpuFeatures::IsSupported(SSE2) ?
+ Builtins::kNotifyStubFailureSaveDoubles : Builtins::kNotifyStubFailure;
+ return isolate_->builtins()->builtin(name);
+}
+
+
#define __ masm()->
void Deoptimizer::EntryGenerator::Generate() {
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 86c525d..e067c90 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -3296,57 +3296,6 @@
}
-void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
- ASSERT(expr->arguments()->length() == 0);
-
- Label slow_allocate_heapnumber;
- Label heapnumber_allocated;
-
- __ AllocateHeapNumber(edi, ebx, ecx, &slow_allocate_heapnumber);
- __ jmp(&heapnumber_allocated);
-
- __ bind(&slow_allocate_heapnumber);
- // Allocate a heap number.
- __ CallRuntime(Runtime::kNumberAlloc, 0);
- __ mov(edi, eax);
-
- __ bind(&heapnumber_allocated);
-
- __ PrepareCallCFunction(1, ebx);
- __ mov(eax, ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX));
- __ mov(eax, FieldOperand(eax, GlobalObject::kNativeContextOffset));
- __ mov(Operand(esp, 0), eax);
- __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
-
- // Convert 32 random bits in eax to 0.(32 random bits) in a double
- // by computing:
- // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
- // This is implemented on both SSE2 and FPU.
- if (CpuFeatures::IsSupported(SSE2)) {
- CpuFeatureScope fscope(masm(), SSE2);
- __ mov(ebx, Immediate(0x49800000)); // 1.0 x 2^20 as single.
- __ movd(xmm1, ebx);
- __ movd(xmm0, eax);
- __ cvtss2sd(xmm1, xmm1);
- __ xorps(xmm0, xmm1);
- __ subsd(xmm0, xmm1);
- __ movsd(FieldOperand(edi, HeapNumber::kValueOffset), xmm0);
- } else {
- // 0x4130000000000000 is 1.0 x 2^20 as a double.
- __ mov(FieldOperand(edi, HeapNumber::kExponentOffset),
- Immediate(0x41300000));
- __ mov(FieldOperand(edi, HeapNumber::kMantissaOffset), eax);
- __ fld_d(FieldOperand(edi, HeapNumber::kValueOffset));
- __ mov(FieldOperand(edi, HeapNumber::kMantissaOffset), Immediate(0));
- __ fld_d(FieldOperand(edi, HeapNumber::kValueOffset));
- __ fsubp(1);
- __ fstp_d(FieldOperand(edi, HeapNumber::kValueOffset));
- }
- __ mov(eax, edi);
- context()->Plug(eax);
-}
-
-
void FullCodeGenerator::EmitSubString(CallRuntime* expr) {
// Load the arguments on the stack and call the stub.
SubStringStub stub;
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc
index f316e85..eb1f960 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -130,6 +130,40 @@
#endif
+void LCodeGen::SaveCallerDoubles() {
+ ASSERT(info()->saves_caller_doubles());
+ ASSERT(NeedsEagerFrame());
+ Comment(";;; Save clobbered callee double registers");
+ CpuFeatureScope scope(masm(), SSE2);
+ int count = 0;
+ BitVector* doubles = chunk()->allocated_double_registers();
+ BitVector::Iterator save_iterator(doubles);
+ while (!save_iterator.Done()) {
+ __ movsd(MemOperand(esp, count * kDoubleSize),
+ XMMRegister::FromAllocationIndex(save_iterator.Current()));
+ save_iterator.Advance();
+ count++;
+ }
+}
+
+
+void LCodeGen::RestoreCallerDoubles() {
+ ASSERT(info()->saves_caller_doubles());
+ ASSERT(NeedsEagerFrame());
+ Comment(";;; Restore clobbered callee double registers");
+ CpuFeatureScope scope(masm(), SSE2);
+ BitVector* doubles = chunk()->allocated_double_registers();
+ BitVector::Iterator save_iterator(doubles);
+ int count = 0;
+ while (!save_iterator.Done()) {
+ __ movsd(XMMRegister::FromAllocationIndex(save_iterator.Current()),
+ MemOperand(esp, count * kDoubleSize));
+ save_iterator.Advance();
+ count++;
+ }
+}
+
+
bool LCodeGen::GeneratePrologue() {
ASSERT(is_generating());
@@ -244,17 +278,7 @@
}
if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) {
- Comment(";;; Save clobbered callee double registers");
- CpuFeatureScope scope(masm(), SSE2);
- int count = 0;
- BitVector* doubles = chunk()->allocated_double_registers();
- BitVector::Iterator save_iterator(doubles);
- while (!save_iterator.Done()) {
- __ movsd(MemOperand(esp, count * kDoubleSize),
- XMMRegister::FromAllocationIndex(save_iterator.Current()));
- save_iterator.Advance();
- count++;
- }
+ SaveCallerDoubles();
}
}
@@ -399,6 +423,7 @@
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
}
if (jump_table_[i].needs_frame) {
+ ASSERT(!info()->saves_caller_doubles());
__ push(Immediate(ExternalReference::ForDeoptEntry(entry)));
if (needs_frame.is_bound()) {
__ jmp(&needs_frame);
@@ -425,6 +450,9 @@
__ ret(0); // Call the continuation without clobbering registers.
}
} else {
+ if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) {
+ RestoreCallerDoubles();
+ }
__ call(entry, RelocInfo::RUNTIME_ENTRY);
}
}
@@ -3129,17 +3157,7 @@
__ CallRuntime(Runtime::kTraceExit, 1);
}
if (info()->saves_caller_doubles() && CpuFeatures::IsSupported(SSE2)) {
- ASSERT(NeedsEagerFrame());
- CpuFeatureScope scope(masm(), SSE2);
- BitVector* doubles = chunk()->allocated_double_registers();
- BitVector::Iterator save_iterator(doubles);
- int count = 0;
- while (!save_iterator.Done()) {
- __ movsd(XMMRegister::FromAllocationIndex(save_iterator.Current()),
- MemOperand(esp, count * kDoubleSize));
- save_iterator.Advance();
- count++;
- }
+ RestoreCallerDoubles();
}
if (dynamic_frame_alignment_) {
// Fetch the state of the dynamic frame alignment.
@@ -4167,69 +4185,6 @@
}
-void LCodeGen::DoRandom(LRandom* instr) {
- CpuFeatureScope scope(masm(), SSE2);
-
- // Assert that the register size is indeed the size of each seed.
- static const int kSeedSize = sizeof(uint32_t);
- STATIC_ASSERT(kPointerSize == kSeedSize);
-
- // Load native context
- Register global_object = ToRegister(instr->global_object());
- Register native_context = global_object;
- __ mov(native_context, FieldOperand(
- global_object, GlobalObject::kNativeContextOffset));
-
- // Load state (FixedArray of the native context's random seeds)
- static const int kRandomSeedOffset =
- FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize;
- Register state = native_context;
- __ mov(state, FieldOperand(native_context, kRandomSeedOffset));
-
- // Load state[0].
- Register state0 = ToRegister(instr->scratch());
- __ mov(state0, FieldOperand(state, ByteArray::kHeaderSize));
- // Load state[1].
- Register state1 = ToRegister(instr->scratch2());
- __ mov(state1, FieldOperand(state, ByteArray::kHeaderSize + kSeedSize));
-
- // state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16)
- Register scratch3 = ToRegister(instr->scratch3());
- __ movzx_w(scratch3, state0);
- __ imul(scratch3, scratch3, 18273);
- __ shr(state0, 16);
- __ add(state0, scratch3);
- // Save state[0].
- __ mov(FieldOperand(state, ByteArray::kHeaderSize), state0);
-
- // state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16)
- __ movzx_w(scratch3, state1);
- __ imul(scratch3, scratch3, 36969);
- __ shr(state1, 16);
- __ add(state1, scratch3);
- // Save state[1].
- __ mov(FieldOperand(state, ByteArray::kHeaderSize + kSeedSize), state1);
-
- // Random bit pattern = (state[0] << 14) + (state[1] & 0x3FFFF)
- Register random = state0;
- __ shl(random, 14);
- __ and_(state1, Immediate(0x3FFFF));
- __ add(random, state1);
-
- // Convert 32 random bits in random to 0.(32 random bits) in a double
- // by computing:
- // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
- XMMRegister result = ToDoubleRegister(instr->result());
- XMMRegister scratch4 = double_scratch0();
- __ mov(scratch3, Immediate(0x49800000)); // 1.0 x 2^20 as single.
- __ movd(scratch4, scratch3);
- __ movd(result, random);
- __ cvtss2sd(scratch4, scratch4);
- __ xorps(result, scratch4);
- __ subsd(result, scratch4);
-}
-
-
void LCodeGen::DoMathLog(LMathLog* instr) {
CpuFeatureScope scope(masm(), SSE2);
ASSERT(instr->value()->Equals(instr->result()));
diff --git a/src/ia32/lithium-codegen-ia32.h b/src/ia32/lithium-codegen-ia32.h
index 52ca07a..638f80c 100644
--- a/src/ia32/lithium-codegen-ia32.h
+++ b/src/ia32/lithium-codegen-ia32.h
@@ -198,6 +198,9 @@
void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); }
+ void SaveCallerDoubles();
+ void RestoreCallerDoubles();
+
// Code generation passes. Returns true if code generation should
// continue.
void GenerateBodyInstructionPre(LInstruction* instr) V8_OVERRIDE;
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
index d4c17ab..5343773 100644
--- a/src/ia32/lithium-ia32.cc
+++ b/src/ia32/lithium-ia32.cc
@@ -1695,19 +1695,6 @@
}
-LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
- ASSERT(instr->representation().IsDouble());
- ASSERT(instr->global_object()->representation().IsTagged());
- LOperand* global_object = UseTempRegister(instr->global_object());
- LOperand* scratch = TempRegister();
- LOperand* scratch2 = TempRegister();
- LOperand* scratch3 = TempRegister();
- LRandom* result = new(zone()) LRandom(
- global_object, scratch, scratch2, scratch3);
- return DefineFixedDouble(result, xmm1);
-}
-
-
LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
ASSERT(instr->left()->representation().IsSmiOrTagged());
ASSERT(instr->right()->representation().IsSmiOrTagged());
diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h
index bc2b71b..b429120 100644
--- a/src/ia32/lithium-ia32.h
+++ b/src/ia32/lithium-ia32.h
@@ -154,7 +154,6 @@
V(OuterContext) \
V(Parameter) \
V(Power) \
- V(Random) \
V(PushArgument) \
V(RegExpLiteral) \
V(Return) \
@@ -1462,28 +1461,6 @@
};
-class LRandom V8_FINAL : public LTemplateInstruction<1, 1, 3> {
- public:
- LRandom(LOperand* global_object,
- LOperand* scratch,
- LOperand* scratch2,
- LOperand* scratch3) {
- inputs_[0] = global_object;
- temps_[0] = scratch;
- temps_[1] = scratch2;
- temps_[2] = scratch3;
- }
-
- LOperand* global_object() const { return inputs_[0]; }
- LOperand* scratch() const { return temps_[0]; }
- LOperand* scratch2() const { return temps_[1]; }
- LOperand* scratch3() const { return temps_[2]; }
-
- DECLARE_CONCRETE_INSTRUCTION(Random, "random")
- DECLARE_HYDROGEN_ACCESSOR(Random)
-};
-
-
class LArithmeticD V8_FINAL : public LTemplateInstruction<1, 2, 0> {
public:
LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc
index d394c09..2d0720a 100644
--- a/src/ia32/macro-assembler-ia32.cc
+++ b/src/ia32/macro-assembler-ia32.cc
@@ -614,6 +614,10 @@
return;
}
+ // Count number of write barriers in generated code.
+ isolate()->counters()->write_barriers_static()->Increment();
+ IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1);
+
// A single check of the map's pages interesting flag suffices, since it is
// only set during incremental collection, and then it's also guaranteed that
// the from object's page's interesting flag is also set. This optimization
@@ -670,6 +674,10 @@
bind(&ok);
}
+ // Count number of write barriers in generated code.
+ isolate()->counters()->write_barriers_static()->Increment();
+ IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1);
+
// First, check if a write barrier is even needed. The tests below
// catch stores of Smis and stores into young gen.
Label done;
diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h
index 58e5907..2941130 100644
--- a/src/ia32/macro-assembler-ia32.h
+++ b/src/ia32/macro-assembler-ia32.h
@@ -777,8 +777,10 @@
}
// Convenience function: Same as above, but takes the fid instead.
- void CallRuntime(Runtime::FunctionId id, int num_arguments) {
- CallRuntime(Runtime::FunctionForId(id), num_arguments);
+ void CallRuntime(Runtime::FunctionId id,
+ int num_arguments,
+ SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
+ CallRuntime(Runtime::FunctionForId(id), num_arguments, save_doubles);
}
// Convenience function: call an external reference.
diff --git a/src/ia32/simulator-ia32.cc b/src/ia32/simulator-ia32.cc
index ab81693..b6f2847 100644
--- a/src/ia32/simulator-ia32.cc
+++ b/src/ia32/simulator-ia32.cc
@@ -27,4 +27,3 @@
// Since there is no simulator for the ia32 architecture this file is empty.
-
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
index adbef17..d26210d 100644
--- a/src/ia32/stub-cache-ia32.cc
+++ b/src/ia32/stub-cache-ia32.cc
@@ -723,9 +723,10 @@
Label miss_cleanup;
Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label;
Register holder =
- stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
- scratch1, scratch2, scratch3,
- name, depth1, miss);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(object, masm->isolate()), receiver,
+ interceptor_holder, scratch1, scratch2, scratch3,
+ name, depth1, miss);
// Invoke an interceptor and if it provides a value,
// branch to |regular_invoke|.
@@ -739,10 +740,10 @@
// Check that the maps from interceptor's holder to constant function's
// holder haven't changed and thus we can use cached constant function.
if (*interceptor_holder != lookup->holder()) {
- stub_compiler_->CheckPrototypes(interceptor_holder, receiver,
- Handle<JSObject>(lookup->holder()),
- scratch1, scratch2, scratch3,
- name, depth2, miss);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(interceptor_holder, masm->isolate()), receiver,
+ handle(lookup->holder()), scratch1, scratch2, scratch3,
+ name, depth2, miss);
} else {
// CheckPrototypes has a side effect of fetching a 'holder'
// for API (object which is instanceof for the signature). It's
@@ -788,9 +789,9 @@
Handle<JSObject> interceptor_holder,
Label* miss_label) {
Register holder =
- stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
- scratch1, scratch2, scratch3,
- name, miss_label);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(object, masm->isolate()), receiver,
+ interceptor_holder, scratch1, scratch2, scratch3, name, miss_label);
FrameScope scope(masm, StackFrame::INTERNAL);
// Save the name_ register across the call.
@@ -1184,26 +1185,6 @@
}
-void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
- Handle<JSObject> object,
- Handle<JSObject> holder,
- Handle<Name> name,
- Register scratch,
- Label* miss) {
- Handle<JSObject> current = object;
- while (!current.is_identical_to(holder)) {
- if (current->IsJSGlobalObject()) {
- GenerateCheckPropertyCell(masm,
- Handle<JSGlobalObject>::cast(current),
- name,
- scratch,
- miss);
- }
- current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
- }
-}
-
-
void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
__ jmp(code, RelocInfo::CODE_TARGET);
}
@@ -1213,7 +1194,7 @@
#define __ ACCESS_MASM(masm())
-Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
+Register StubCompiler::CheckPrototypes(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
@@ -1223,12 +1204,11 @@
int save_at_depth,
Label* miss,
PrototypeCheckType check) {
- const int kHolderIndex = FunctionCallbackArguments::kHolderIndex + 1;
+ Handle<Map> receiver_map(IC::TypeToMap(*type, isolate()));
// Make sure that the type feedback oracle harvests the receiver map.
// TODO(svenpanne) Remove this hack when all ICs are reworked.
- __ mov(scratch1, Handle<Map>(object->map()));
+ __ mov(scratch1, receiver_map);
- Handle<JSObject> first = object;
// Make sure there's no overlap between holder and object registers.
ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg)
@@ -1236,31 +1216,38 @@
// Keep track of the current object in register reg.
Register reg = object_reg;
- Handle<JSObject> current = object;
int depth = 0;
+ const int kHolderIndex = FunctionCallbackArguments::kHolderIndex + 1;
if (save_at_depth == depth) {
__ mov(Operand(esp, kHolderIndex * kPointerSize), reg);
}
+ Handle<JSObject> current = Handle<JSObject>::null();
+ if (type->IsConstant()) current = Handle<JSObject>::cast(type->AsConstant());
+ Handle<JSObject> prototype = Handle<JSObject>::null();
+ Handle<Map> current_map = receiver_map;
+ Handle<Map> holder_map(holder->map());
// Traverse the prototype chain and check the maps in the prototype chain for
// fast and global objects or do negative lookup for normal objects.
- while (!current.is_identical_to(holder)) {
+ while (!current_map.is_identical_to(holder_map)) {
++depth;
// Only global objects and objects that do not require access
// checks are allowed in stubs.
- ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
+ ASSERT(current_map->IsJSGlobalProxyMap() ||
+ !current_map->is_access_check_needed());
- Handle<JSObject> prototype(JSObject::cast(current->GetPrototype()));
- if (!current->HasFastProperties() &&
- !current->IsJSGlobalObject() &&
- !current->IsJSGlobalProxy()) {
+ prototype = handle(JSObject::cast(current_map->prototype()));
+ if (current_map->is_dictionary_map() &&
+ !current_map->IsJSGlobalObjectMap() &&
+ !current_map->IsJSGlobalProxyMap()) {
if (!name->IsUniqueName()) {
ASSERT(name->IsString());
name = factory()->InternalizeString(Handle<String>::cast(name));
}
- ASSERT(current->property_dictionary()->FindEntry(*name) ==
+ ASSERT(current.is_null() ||
+ current->property_dictionary()->FindEntry(*name) ==
NameDictionary::kNotFound);
GenerateDictionaryNegativeLookup(masm(), miss, reg, name,
@@ -1271,16 +1258,19 @@
__ mov(reg, FieldOperand(scratch1, Map::kPrototypeOffset));
} else {
bool in_new_space = heap()->InNewSpace(*prototype);
- Handle<Map> current_map(current->map());
- if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) {
+ if (depth != 1 || check == CHECK_ALL_MAPS) {
__ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK);
}
// Check access rights to the global object. This has to happen after
// the map check so that we know that the object is actually a global
// object.
- if (current->IsJSGlobalProxy()) {
+ if (current_map->IsJSGlobalProxyMap()) {
__ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss);
+ } else if (current_map->IsJSGlobalObjectMap()) {
+ GenerateCheckPropertyCell(
+ masm(), Handle<JSGlobalObject>::cast(current), name,
+ scratch2, miss);
}
if (in_new_space) {
@@ -1306,28 +1296,24 @@
// Go to the next object in the prototype chain.
current = prototype;
+ current_map = handle(current->map());
}
- ASSERT(current.is_identical_to(holder));
// Log the check depth.
LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
- if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) {
+ if (depth != 0 || check == CHECK_ALL_MAPS) {
// Check the holder map.
- __ CheckMap(reg, Handle<Map>(holder->map()), miss, DONT_DO_SMI_CHECK);
+ __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK);
}
// Perform security check for access to the global object.
- ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
- if (holder->IsJSGlobalProxy()) {
+ ASSERT(current_map->IsJSGlobalProxyMap() ||
+ !current_map->is_access_check_needed());
+ if (current_map->IsJSGlobalProxyMap()) {
__ CheckAccessGlobalProxy(reg, scratch1, scratch2, miss);
}
- // If we've skipped any global objects, it's not enough to verify that
- // their maps haven't changed. We also need to check that the property
- // cell for the property is still empty.
- GenerateCheckPropertyCells(masm(), object, holder, name, scratch1, miss);
-
// Return the register containing the holder.
return reg;
}
@@ -1356,14 +1342,14 @@
Register LoadStubCompiler::CallbackHandlerFrontend(
- Handle<Object> object,
+ Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
- Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
+ Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
ASSERT(!reg.is(scratch2()));
@@ -1638,7 +1624,8 @@
// Check that the maps haven't changed.
__ JumpIfSmi(edx, miss);
- CheckPrototypes(object, edx, holder, ebx, eax, edi, name, miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, miss);
}
@@ -1707,8 +1694,8 @@
__ JumpIfSmi(edx, &miss);
// Do the right check and compute the holder register.
- Register reg = CheckPrototypes(object, edx, holder, ebx, eax, edi,
- name, &miss);
+ Register reg = CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx,
+ holder, ebx, eax, edi, name, &miss);
GenerateFastPropertyLoad(
masm(), edi, reg, index.is_inobject(holder),
@@ -1761,8 +1748,8 @@
// Check that the receiver isn't a smi.
__ JumpIfSmi(edx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax, edi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -1821,8 +1808,8 @@
// Check that the receiver isn't a smi.
__ JumpIfSmi(edx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax, edi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, &miss);
if (argc == 0) {
// Noop, return the length.
@@ -2081,8 +2068,8 @@
// Check that the receiver isn't a smi.
__ JumpIfSmi(edx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax, edi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, &miss);
// Get the elements array of the object.
__ mov(ebx, FieldOperand(edx, JSArray::kElementsOffset));
@@ -2175,8 +2162,9 @@
eax,
&miss);
ASSERT(!object.is_identical_to(holder));
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
eax, holder, ebx, edx, edi, name, &miss);
Register receiver = ebx;
@@ -2260,8 +2248,9 @@
eax,
&miss);
ASSERT(!object.is_identical_to(holder));
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
eax, holder, ebx, edx, edi, name, &miss);
Register receiver = eax;
@@ -2336,8 +2325,8 @@
__ mov(edx, Operand(esp, 2 * kPointerSize));
STATIC_ASSERT(kSmiTag == 0);
__ JumpIfSmi(edx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax, edi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2421,8 +2410,8 @@
STATIC_ASSERT(kSmiTag == 0);
__ JumpIfSmi(edx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax, edi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2547,8 +2536,8 @@
STATIC_ASSERT(kSmiTag == 0);
__ JumpIfSmi(edx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax, edi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2661,8 +2650,8 @@
__ sub(esp, Immediate(kFastApiCallArguments * kPointerSize));
// Check that the maps haven't changed and find a Holder as a side effect.
- CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax, edi,
- name, depth, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, depth, &miss);
// Move the return address on top of the stack.
__ mov(eax, Operand(esp, kFastApiCallArguments * kPointerSize));
@@ -2725,8 +2714,8 @@
__ IncrementCounter(isolate()->counters()->call_const(), 1);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), edx, holder, ebx, eax,
- edi, name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), edx, holder,
+ ebx, eax, edi, name, &miss);
// Patch the receiver on the stack with the global proxy if
// necessary.
@@ -2736,30 +2725,32 @@
}
break;
- case STRING_CHECK:
+ case STRING_CHECK: {
// Check that the object is a string.
__ CmpObjectType(edx, FIRST_NONSTRING_TYPE, eax);
__ j(above_equal, &miss);
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::STRING_FUNCTION_INDEX, eax, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
eax, holder, ebx, edx, edi, name, &miss);
break;
-
- case SYMBOL_CHECK:
+ }
+ case SYMBOL_CHECK: {
// Check that the object is a symbol.
__ CmpObjectType(edx, SYMBOL_TYPE, eax);
__ j(not_equal, &miss);
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::SYMBOL_FUNCTION_INDEX, eax, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
eax, holder, ebx, edx, edi, name, &miss);
break;
-
+ }
case NUMBER_CHECK: {
Label fast;
// Check that the object is a smi or a heap number.
@@ -2770,8 +2761,9 @@
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::NUMBER_FUNCTION_INDEX, eax, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
eax, holder, ebx, edx, edi, name, &miss);
break;
}
@@ -2780,8 +2772,9 @@
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::BOOLEAN_FUNCTION_INDEX, eax, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
eax, holder, ebx, edx, edi, name, &miss);
break;
}
@@ -2959,7 +2952,8 @@
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
__ pop(scratch1()); // remove the return address
__ push(receiver());
@@ -2983,7 +2977,8 @@
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
Register values[] = { value() };
GenerateFastApiCall(
@@ -3090,12 +3085,10 @@
}
-Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
- Handle<Object> object,
- Handle<JSObject> last,
- Handle<Name> name,
- Handle<JSGlobalObject> global) {
- NonexistentHandlerFrontend(object, last, name, global);
+Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
+ Handle<JSObject> last,
+ Handle<Name> name) {
+ NonexistentHandlerFrontend(type, last, name);
// Return undefined if maps of the full prototype chain are still the
// same and no global property with this name contains a value.
@@ -3186,14 +3179,14 @@
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
- Handle<Object> object,
+ Handle<Type> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
bool is_dont_delete) {
Label miss;
- HandlerFrontendHeader(object, receiver(), global, name, &miss);
+ HandlerFrontendHeader(type, receiver(), global, name, &miss);
// Get the value from the cell.
if (Serializer::enabled()) {
__ mov(eax, Immediate(cell));
diff --git a/src/ic-inl.h b/src/ic-inl.h
index bd45c3e..1840587 100644
--- a/src/ic-inl.h
+++ b/src/ic-inl.h
@@ -149,7 +149,7 @@
}
return handle(JSObject::cast(constructor->instance_prototype())->map());
}
- return type->AsClass();
+ return TypeToMap(type, isolate);
}
diff --git a/src/ic.cc b/src/ic.cc
index 53c103a..c22f3c1 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -783,7 +783,7 @@
: Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate())),
isolate());
- PatchCache(handle(Type::CurrentOf(cache_object), isolate()), name, code);
+ PatchCache(CurrentTypeOf(cache_object, isolate()), name, code);
TRACE_IC("CallIC", name);
}
@@ -989,7 +989,7 @@
// If the receiver type is already in the polymorphic IC, this indicates
// there was a prototoype chain failure. In that case, just overwrite the
// handler.
- } else if (type->Is(current_type)) {
+ } else if (type->IsCurrently(current_type)) {
ASSERT(handler_to_overwrite == -1);
number_of_valid_types--;
handler_to_overwrite = i;
@@ -1015,9 +1015,20 @@
}
+Handle<Type> IC::CurrentTypeOf(Handle<Object> object, Isolate* isolate) {
+ Type* type = object->IsJSGlobalObject()
+ ? Type::Constant(Handle<JSGlobalObject>::cast(object))
+ : Type::OfCurrently(object);
+ return handle(type, isolate);
+}
+
+
Handle<Map> IC::TypeToMap(Type* type, Isolate* isolate) {
if (type->Is(Type::Number())) return isolate->factory()->heap_number_map();
if (type->Is(Type::Boolean())) return isolate->factory()->oddball_map();
+ if (type->IsConstant()) {
+ return handle(Handle<JSGlobalObject>::cast(type->AsConstant())->map());
+ }
ASSERT(type->IsClass());
return type->AsClass();
}
@@ -1134,13 +1145,14 @@
return;
}
+ Handle<Type> type = CurrentTypeOf(object, isolate());
Handle<Code> code;
if (!lookup->IsCacheable()) {
// Bail out if the result is not cacheable.
code = slow_stub();
} else if (!lookup->IsProperty()) {
if (kind() == Code::LOAD_IC) {
- code = isolate()->stub_cache()->ComputeLoadNonexistent(name, object);
+ code = isolate()->stub_cache()->ComputeLoadNonexistent(name, type);
} else {
code = slow_stub();
}
@@ -1148,7 +1160,7 @@
code = ComputeHandler(lookup, object, name);
}
- PatchCache(handle(Type::CurrentOf(object), isolate()), name, code);
+ PatchCache(type, name, code);
TRACE_IC("LoadIC", name);
}
@@ -1170,7 +1182,7 @@
isolate(), *object, cache_holder));
Handle<Code> code = isolate()->stub_cache()->FindHandler(
- name, stub_holder, kind(), cache_holder, strict_mode());
+ name, handle(stub_holder->map()), kind(), cache_holder, strict_mode());
if (!code.is_null()) return code;
code = CompileHandler(lookup, object, name, value, cache_holder);
@@ -1194,6 +1206,7 @@
return SimpleFieldLoad(length_index);
}
+ Handle<Type> type = CurrentTypeOf(object, isolate());
Handle<JSObject> holder(lookup->holder());
LoadStubCompiler compiler(isolate(), cache_holder, kind());
@@ -1206,14 +1219,14 @@
lookup->representation());
}
return compiler.CompileLoadField(
- object, holder, name, field, lookup->representation());
+ type, holder, name, field, lookup->representation());
}
case CONSTANT: {
Handle<Object> constant(lookup->GetConstant(), isolate());
// TODO(2803): Don't compute a stub for cons strings because they cannot
// be embedded into code.
if (constant->IsConsString()) break;
- return compiler.CompileLoadConstant(object, holder, name, constant);
+ return compiler.CompileLoadConstant(type, holder, name, constant);
}
case NORMAL:
if (kind() != Code::LOAD_IC) break;
@@ -1222,7 +1235,7 @@
Handle<PropertyCell> cell(
global->GetPropertyCell(lookup), isolate());
Handle<Code> code = compiler.CompileLoadGlobal(
- object, global, cell, name, lookup->IsDontDelete());
+ type, global, cell, name, lookup->IsDontDelete());
// TODO(verwaest): Move caching of these NORMAL stubs outside as well.
Handle<HeapObject> stub_holder(GetCodeCacheHolder(
isolate(), *object, cache_holder));
@@ -1252,7 +1265,7 @@
Handle<ExecutableAccessorInfo>::cast(callback);
if (v8::ToCData<Address>(info->getter()) == 0) break;
if (!info->IsCompatibleReceiver(*object)) break;
- return compiler.CompileLoadCallback(object, holder, name, info);
+ return compiler.CompileLoadCallback(type, holder, name, info);
} else if (callback->IsAccessorPair()) {
Handle<Object> getter(Handle<AccessorPair>::cast(callback)->getter(),
isolate());
@@ -1271,9 +1284,9 @@
if (call_optimization.is_simple_api_call() &&
call_optimization.IsCompatibleReceiver(*object)) {
return compiler.CompileLoadCallback(
- object, holder, name, call_optimization);
+ type, holder, name, call_optimization);
}
- return compiler.CompileLoadViaGetter(object, holder, name, function);
+ return compiler.CompileLoadViaGetter(type, holder, name, function);
}
// TODO(dcarney): Handle correctly.
if (callback->IsDeclaredAccessorInfo()) break;
@@ -1283,7 +1296,7 @@
}
case INTERCEPTOR:
ASSERT(HasInterceptorGetter(*holder));
- return compiler.CompileLoadInterceptor(object, holder, name);
+ return compiler.CompileLoadInterceptor(type, holder, name);
default:
break;
}
@@ -1609,7 +1622,7 @@
Handle<Code> code = ComputeHandler(lookup, receiver, name, value);
- PatchCache(handle(Type::CurrentOf(receiver), isolate()), name, code);
+ PatchCache(CurrentTypeOf(receiver, isolate()), name, code);
TRACE_IC("StoreIC", name);
}
diff --git a/src/ic.h b/src/ic.h
index 7113b0b..4a3e716 100644
--- a/src/ic.h
+++ b/src/ic.h
@@ -165,6 +165,7 @@
// - The oddball map is only used for booleans.
static Handle<Map> TypeToMap(Type* type, Isolate* isolate);
static Type* MapToType(Handle<Map> type);
+ static Handle<Type> CurrentTypeOf(Handle<Object> object, Isolate* isolate);
protected:
// Get the call-site target; used for determining the state.
diff --git a/src/isolate.cc b/src/isolate.cc
index 2acc59a..941ac42 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -2059,12 +2059,22 @@
// If we are deserializing, log non-function code objects and compiled
// functions found in the snapshot.
if (!create_heap_objects &&
- (FLAG_log_code || FLAG_ll_prof || logger_->is_logging_code_events())) {
+ (FLAG_log_code ||
+ FLAG_ll_prof ||
+ FLAG_perf_jit_prof ||
+ FLAG_perf_basic_prof ||
+ logger_->is_logging_code_events())) {
HandleScope scope(this);
LOG(this, LogCodeObjects());
LOG(this, LogCompiledFunctions());
}
+ // If we are profiling with the Linux perf tool, we need to disable
+ // code relocation.
+ if (FLAG_perf_jit_prof || FLAG_perf_basic_prof) {
+ FLAG_compact_code_space = false;
+ }
+
CHECK_EQ(static_cast<int>(OFFSET_OF(Isolate, embedder_data_)),
Internals::kIsolateEmbedderDataOffset);
CHECK_EQ(static_cast<int>(OFFSET_OF(Isolate, heap_.roots_)),
diff --git a/src/log-utils.h b/src/log-utils.h
index ec8415e..f1a21e2 100644
--- a/src/log-utils.h
+++ b/src/log-utils.h
@@ -47,7 +47,8 @@
static bool InitLogAtStart() {
return FLAG_log || FLAG_log_runtime || FLAG_log_api
|| FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect
- || FLAG_log_regexp || FLAG_ll_prof || FLAG_log_internal_timer_events;
+ || FLAG_log_regexp || FLAG_ll_prof || FLAG_perf_basic_prof
+ || FLAG_perf_jit_prof || FLAG_log_internal_timer_events;
}
// Frees all resources acquired in Initialize and Open... functions.
diff --git a/src/log.cc b/src/log.cc
index b353f54..e123231 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -246,6 +246,231 @@
}
+// Linux perf tool logging support
+class PerfBasicLogger : public CodeEventLogger {
+ public:
+ PerfBasicLogger();
+ virtual ~PerfBasicLogger();
+
+ virtual void CodeMoveEvent(Address from, Address to) { }
+ virtual void CodeDeleteEvent(Address from) { }
+
+ private:
+ virtual void LogRecordedBuffer(Code* code,
+ SharedFunctionInfo* shared,
+ const char* name,
+ int length);
+
+ // Extension added to V8 log file name to get the low-level log name.
+ static const char kFilenameFormatString[];
+ static const int kFilenameBufferPadding;
+
+ // File buffer size of the low-level log. We don't use the default to
+ // minimize the associated overhead.
+ static const int kLogBufferSize = 2 * MB;
+
+ FILE* perf_output_handle_;
+};
+
+const char PerfBasicLogger::kFilenameFormatString[] = "/tmp/perf-%d.map";
+// Extra space for the PID in the filename
+const int PerfBasicLogger::kFilenameBufferPadding = 16;
+
+PerfBasicLogger::PerfBasicLogger()
+ : perf_output_handle_(NULL) {
+ // Open the perf JIT dump file.
+ int bufferSize = sizeof(kFilenameFormatString) + kFilenameBufferPadding;
+ ScopedVector<char> perf_dump_name(bufferSize);
+ int size = OS::SNPrintF(
+ perf_dump_name,
+ kFilenameFormatString,
+ OS::GetCurrentProcessId());
+ CHECK_NE(size, -1);
+ perf_output_handle_ = OS::FOpen(perf_dump_name.start(), OS::LogFileOpenMode);
+ CHECK_NE(perf_output_handle_, NULL);
+ setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize);
+}
+
+
+PerfBasicLogger::~PerfBasicLogger() {
+ fclose(perf_output_handle_);
+ perf_output_handle_ = NULL;
+}
+
+
+void PerfBasicLogger::LogRecordedBuffer(Code* code,
+ SharedFunctionInfo*,
+ const char* name,
+ int length) {
+ ASSERT(code->instruction_start() == code->address() + Code::kHeaderSize);
+
+ OS::FPrint(perf_output_handle_, "%llx %x %.*s\n",
+ reinterpret_cast<uint64_t>(code->instruction_start()),
+ code->instruction_size(),
+ length, name);
+}
+
+
+// Linux perf tool logging support
+class PerfJitLogger : public CodeEventLogger {
+ public:
+ PerfJitLogger();
+ virtual ~PerfJitLogger();
+
+ virtual void CodeMoveEvent(Address from, Address to) { }
+ virtual void CodeDeleteEvent(Address from) { }
+
+ private:
+ virtual void LogRecordedBuffer(Code* code,
+ SharedFunctionInfo* shared,
+ const char* name,
+ int length);
+
+ // Extension added to V8 log file name to get the low-level log name.
+ static const char kFilenameFormatString[];
+ static const int kFilenameBufferPadding;
+
+ // File buffer size of the low-level log. We don't use the default to
+ // minimize the associated overhead.
+ static const int kLogBufferSize = 2 * MB;
+
+ void LogWriteBytes(const char* bytes, int size);
+ void LogWriteHeader();
+
+ static const uint32_t kJitHeaderMagic = 0x4F74496A;
+ static const uint32_t kJitHeaderVersion = 0x2;
+ static const uint32_t kElfMachIA32 = 3;
+ static const uint32_t kElfMachX64 = 62;
+ static const uint32_t kElfMachARM = 40;
+ static const uint32_t kElfMachMIPS = 10;
+
+ struct jitheader {
+ uint32_t magic;
+ uint32_t version;
+ uint32_t total_size;
+ uint32_t elf_mach;
+ uint32_t pad1;
+ uint32_t pid;
+ uint64_t timestamp;
+ };
+
+ enum jit_record_type {
+ JIT_CODE_LOAD = 0
+ // JIT_CODE_UNLOAD = 1,
+ // JIT_CODE_CLOSE = 2,
+ // JIT_CODE_DEBUG_INFO = 3,
+ // JIT_CODE_PAGE_MAP = 4,
+ // JIT_CODE_MAX = 5
+ };
+
+ struct jr_code_load {
+ uint32_t id;
+ uint32_t total_size;
+ uint64_t timestamp;
+ uint64_t vma;
+ uint64_t code_addr;
+ uint32_t code_size;
+ uint32_t align;
+ };
+
+ uint32_t GetElfMach() {
+#if V8_TARGET_ARCH_IA32
+ return kElfMachIA32;
+#elif V8_TARGET_ARCH_X64
+ return kElfMachX64;
+#elif V8_TARGET_ARCH_ARM
+ return kElfMachARM;
+#elif V8_TARGET_ARCH_MIPS
+ return kElfMachMIPS;
+#else
+ UNIMPLEMENTED();
+ return 0;
+#endif
+ }
+
+ FILE* perf_output_handle_;
+};
+
+const char PerfJitLogger::kFilenameFormatString[] = "/tmp/jit-%d.dump";
+
+// Extra padding for the PID in the filename
+const int PerfJitLogger::kFilenameBufferPadding = 16;
+
+PerfJitLogger::PerfJitLogger()
+ : perf_output_handle_(NULL) {
+ // Open the perf JIT dump file.
+ int bufferSize = sizeof(kFilenameFormatString) + kFilenameBufferPadding;
+ ScopedVector<char> perf_dump_name(bufferSize);
+ int size = OS::SNPrintF(
+ perf_dump_name,
+ kFilenameFormatString,
+ OS::GetCurrentProcessId());
+ CHECK_NE(size, -1);
+ perf_output_handle_ = OS::FOpen(perf_dump_name.start(), OS::LogFileOpenMode);
+ CHECK_NE(perf_output_handle_, NULL);
+ setvbuf(perf_output_handle_, NULL, _IOFBF, kLogBufferSize);
+
+ LogWriteHeader();
+}
+
+
+PerfJitLogger::~PerfJitLogger() {
+ fclose(perf_output_handle_);
+ perf_output_handle_ = NULL;
+}
+
+
+void PerfJitLogger::LogRecordedBuffer(Code* code,
+ SharedFunctionInfo*,
+ const char* name,
+ int length) {
+ ASSERT(code->instruction_start() == code->address() + Code::kHeaderSize);
+ ASSERT(perf_output_handle_ != NULL);
+
+ const char* code_name = name;
+ uint8_t* code_pointer = reinterpret_cast<uint8_t*>(code->instruction_start());
+ uint32_t code_size = code->instruction_size();
+
+ static const char string_terminator[] = "\0";
+
+ jr_code_load code_load;
+ code_load.id = JIT_CODE_LOAD;
+ code_load.total_size = sizeof(code_load) + length + 1 + code_size;
+ code_load.timestamp =
+ static_cast<uint64_t>(OS::TimeCurrentMillis() * 1000.0);
+ code_load.vma = 0x0; // Our addresses are absolute.
+ code_load.code_addr = reinterpret_cast<uint64_t>(code->instruction_start());
+ code_load.code_size = code_size;
+ code_load.align = 0;
+
+ LogWriteBytes(reinterpret_cast<const char*>(&code_load), sizeof(code_load));
+ LogWriteBytes(code_name, length);
+ LogWriteBytes(string_terminator, 1);
+ LogWriteBytes(reinterpret_cast<const char*>(code_pointer), code_size);
+}
+
+
+void PerfJitLogger::LogWriteBytes(const char* bytes, int size) {
+ size_t rv = fwrite(bytes, 1, size, perf_output_handle_);
+ ASSERT(static_cast<size_t>(size) == rv);
+ USE(rv);
+}
+
+
+void PerfJitLogger::LogWriteHeader() {
+ ASSERT(perf_output_handle_ != NULL);
+ jitheader header;
+ header.magic = kJitHeaderMagic;
+ header.version = kJitHeaderVersion;
+ header.total_size = sizeof(jitheader);
+ header.pad1 = 0xdeadbeef;
+ header.elf_mach = GetElfMach();
+ header.pid = OS::GetCurrentProcessId();
+ header.timestamp = static_cast<uint64_t>(OS::TimeCurrentMillis() * 1000.0);
+ LogWriteBytes(reinterpret_cast<const char*>(&header), sizeof(header));
+}
+
+
// Low-level logging support.
#define LL_LOG(Call) if (ll_logger_) ll_logger_->Call;
@@ -711,6 +936,8 @@
log_events_(NULL),
is_logging_(false),
log_(new Log(this)),
+ perf_basic_logger_(NULL),
+ perf_jit_logger_(NULL),
ll_logger_(NULL),
jit_logger_(NULL),
listeners_(5),
@@ -1844,6 +2071,17 @@
PrepareLogFileName(isolate, FLAG_logfile);
log_->Initialize(*log_file_name);
+
+ if (FLAG_perf_basic_prof) {
+ perf_basic_logger_ = new PerfBasicLogger();
+ addCodeEventListener(perf_basic_logger_);
+ }
+
+ if (FLAG_perf_jit_prof) {
+ perf_jit_logger_ = new PerfJitLogger();
+ addCodeEventListener(perf_jit_logger_);
+ }
+
if (FLAG_ll_prof) {
ll_logger_ = new LowLevelLogger(*log_file_name);
addCodeEventListener(ll_logger_);
@@ -1906,6 +2144,18 @@
delete ticker_;
ticker_ = NULL;
+ if (perf_basic_logger_) {
+ removeCodeEventListener(perf_basic_logger_);
+ delete perf_basic_logger_;
+ perf_basic_logger_ = NULL;
+ }
+
+ if (perf_jit_logger_) {
+ removeCodeEventListener(perf_jit_logger_);
+ delete perf_jit_logger_;
+ perf_jit_logger_ = NULL;
+ }
+
if (ll_logger_) {
removeCodeEventListener(ll_logger_);
delete ll_logger_;
diff --git a/src/log.h b/src/log.h
index c0efd65..e53551d 100644
--- a/src/log.h
+++ b/src/log.h
@@ -154,7 +154,9 @@
class JitLogger;
+class PerfBasicLogger;
class LowLevelLogger;
+class PerfJitLogger;
class Sampler;
class Logger {
@@ -437,6 +439,8 @@
bool is_logging_;
Log* log_;
+ PerfBasicLogger* perf_basic_logger_;
+ PerfJitLogger* perf_jit_logger_;
LowLevelLogger* ll_logger_;
JitLogger* jit_logger_;
List<CodeEventListener*> listeners_;
diff --git a/src/mark-compact.cc b/src/mark-compact.cc
index acd36a9..bfb9016 100644
--- a/src/mark-compact.cc
+++ b/src/mark-compact.cc
@@ -2655,6 +2655,7 @@
if (IsMarked(code) && !code->marked_for_deoptimization()) {
code->set_marked_for_deoptimization(true);
+ code->InvalidateEmbeddedObjects();
have_code_to_deoptimize_ = true;
}
entries->clear_at(i);
diff --git a/src/math.js b/src/math.js
index c163d9a..fb7d306 100644
--- a/src/math.js
+++ b/src/math.js
@@ -169,8 +169,15 @@
}
// ECMA 262 - 15.8.2.14
+var rngstate; // Initialized to a Uint32Array during genesis.
function MathRandom() {
- return %_RandomHeapNumber();
+ var r0 = (MathImul(18273, rngstate[0] & 0xFFFF) + (rngstate[0] >>> 16)) | 0;
+ rngstate[0] = r0;
+ var r1 = (MathImul(36969, rngstate[1] & 0xFFFF) + (rngstate[1] >>> 16)) | 0;
+ rngstate[1] = r1;
+ var x = ((r0 << 16) + (r1 & 0xFFFF)) | 0;
+ // Division by 0x100000000 through multiplication by reciprocal.
+ return (x < 0 ? (x + 0x100000000) : x) * 2.3283064365386962890625e-10;
}
// ECMA 262 - 15.8.2.15
diff --git a/src/mips/assembler-mips-inl.h b/src/mips/assembler-mips-inl.h
index d5af5b2..514b3aa 100644
--- a/src/mips/assembler-mips-inl.h
+++ b/src/mips/assembler-mips-inl.h
@@ -260,16 +260,14 @@
Code* RelocInfo::code_age_stub() {
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
return Code::GetCodeFromTargetAddress(
- Memory::Address_at(pc_ + Assembler::kInstrSize *
- (kNoCodeAgeSequenceLength - 1)));
+ Assembler::target_address_at(pc_ + Assembler::kInstrSize));
}
void RelocInfo::set_code_age_stub(Code* stub) {
ASSERT(rmode_ == RelocInfo::CODE_AGE_SEQUENCE);
- Memory::Address_at(pc_ + Assembler::kInstrSize *
- (kNoCodeAgeSequenceLength - 1)) =
- stub->instruction_start();
+ Assembler::set_target_address_at(pc_ + Assembler::kInstrSize,
+ stub->instruction_start());
}
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc
index 85588e8..19f3cdf 100644
--- a/src/mips/builtins-mips.cc
+++ b/src/mips/builtins-mips.cc
@@ -813,12 +813,9 @@
// internal frame to make the code faster, since we shouldn't have to do stack
// crawls in MakeCodeYoung. This seems a bit fragile.
- __ mov(a0, ra);
- // Adjust a0 to point to the head of the PlatformCodeAge sequence
+ // Set a0 to point to the head of the PlatformCodeAge sequence.
__ Subu(a0, a0,
Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize));
- // Restore the original return address of the function
- __ mov(ra, at);
// The following registers must be saved and restored when calling through to
// the runtime:
@@ -855,12 +852,9 @@
// save/restore the registers without worrying about which of them contain
// pointers.
- __ mov(a0, ra);
- // Adjust a0 to point to the head of the PlatformCodeAge sequence
+ // Set a0 to point to the head of the PlatformCodeAge sequence.
__ Subu(a0, a0,
Operand((kNoCodeAgeSequenceLength - 1) * Assembler::kInstrSize));
- // Restore the original return address of the function
- __ mov(ra, at);
// The following registers must be saved and restored when calling through to
// the runtime:
@@ -892,7 +886,8 @@
}
-void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
+static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
+ SaveFPRegsMode save_doubles) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -901,7 +896,7 @@
// registers.
__ MultiPush(kJSCallerSaved | kCalleeSaved);
// Pass the function and deoptimization type to the runtime system.
- __ CallRuntime(Runtime::kNotifyStubFailure, 0);
+ __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles);
__ MultiPop(kJSCallerSaved | kCalleeSaved);
}
@@ -910,6 +905,16 @@
}
+void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
+ Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
+}
+
+
+void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
+ Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
+}
+
+
static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
Deoptimizer::BailoutType type) {
{
diff --git a/src/mips/codegen-mips.cc b/src/mips/codegen-mips.cc
index 221a0e1..3a87c5a 100644
--- a/src/mips/codegen-mips.cc
+++ b/src/mips/codegen-mips.cc
@@ -642,8 +642,8 @@
*age = kNoAgeCodeAge;
*parity = NO_MARKING_PARITY;
} else {
- Address target_address = Memory::Address_at(
- sequence + Assembler::kInstrSize * (kNoCodeAgeSequenceLength - 1));
+ Address target_address = Assembler::target_address_at(
+ sequence + Assembler::kInstrSize);
Code* stub = GetCodeFromTargetAddress(target_address);
GetCodeAgeAndParity(stub, age, parity);
}
@@ -662,17 +662,18 @@
} else {
Code* stub = GetCodeAgeStub(isolate, age, parity);
CodePatcher patcher(sequence, young_length / Assembler::kInstrSize);
- // Mark this code sequence for FindPlatformCodeAgeSequence()
+ // Mark this code sequence for FindPlatformCodeAgeSequence().
patcher.masm()->nop(Assembler::CODE_AGE_MARKER_NOP);
- // Save the function's original return address
- // (it will be clobbered by Call(t9))
- patcher.masm()->mov(at, ra);
- // Load the stub address to t9 and call it
- patcher.masm()->li(t9,
- Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
- patcher.masm()->Call(t9);
- // Record the stub address in the empty space for GetCodeAgeAndParity()
- patcher.masm()->emit_code_stub_address(stub);
+ // Load the stub address to t9 and call it,
+ // GetCodeAgeAndParity() extracts the stub address from this instruction.
+ patcher.masm()->li(
+ t9,
+ Operand(reinterpret_cast<uint32_t>(stub->instruction_start())),
+ CONSTANT_SIZE);
+ patcher.masm()->nop(); // Prevent jalr to jal optimization.
+ patcher.masm()->jalr(t9, a0);
+ patcher.masm()->nop(); // Branch delay slot nop.
+ patcher.masm()->nop(); // Pad the empty space.
}
}
diff --git a/src/mips/deoptimizer-mips.cc b/src/mips/deoptimizer-mips.cc
index c66472f..0662b17 100644
--- a/src/mips/deoptimizer-mips.cc
+++ b/src/mips/deoptimizer-mips.cc
@@ -125,6 +125,11 @@
}
+Code* Deoptimizer::NotifyStubFailureBuiltin() {
+ return isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles);
+}
+
+
#define __ masm()->
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index 6ef871f..486eb9d 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -3378,48 +3378,6 @@
}
-void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
- ASSERT(expr->arguments()->length() == 0);
- Label slow_allocate_heapnumber;
- Label heapnumber_allocated;
-
- // Save the new heap number in callee-saved register s0, since
- // we call out to external C code below.
- __ LoadRoot(t6, Heap::kHeapNumberMapRootIndex);
- __ AllocateHeapNumber(s0, a1, a2, t6, &slow_allocate_heapnumber);
- __ jmp(&heapnumber_allocated);
-
- __ bind(&slow_allocate_heapnumber);
-
- // Allocate a heap number.
- __ CallRuntime(Runtime::kNumberAlloc, 0);
- __ mov(s0, v0); // Save result in s0, so it is saved thru CFunc call.
-
- __ bind(&heapnumber_allocated);
-
- // Convert 32 random bits in v0 to 0.(32 random bits) in a double
- // by computing:
- // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
- __ PrepareCallCFunction(1, a0);
- __ lw(a0, ContextOperand(cp, Context::GLOBAL_OBJECT_INDEX));
- __ lw(a0, FieldMemOperand(a0, GlobalObject::kNativeContextOffset));
- __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
-
- // 0x41300000 is the top half of 1.0 x 2^20 as a double.
- __ li(a1, Operand(0x41300000));
- // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU.
- __ Move(f12, v0, a1);
- // Move 0x4130000000000000 to FPU.
- __ Move(f14, zero_reg, a1);
- // Subtract and store the result in the heap number.
- __ sub_d(f0, f12, f14);
- __ sdc1(f0, FieldMemOperand(s0, HeapNumber::kValueOffset));
- __ mov(v0, s0);
-
- context()->Plug(v0);
-}
-
-
void FullCodeGenerator::EmitSubString(CallRuntime* expr) {
// Load the arguments on the stack and call the stub.
SubStringStub stub;
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc
index 43d83bd..af56262 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -98,6 +98,38 @@
}
+void LCodeGen::SaveCallerDoubles() {
+ ASSERT(info()->saves_caller_doubles());
+ ASSERT(NeedsEagerFrame());
+ Comment(";;; Save clobbered callee double registers");
+ int count = 0;
+ BitVector* doubles = chunk()->allocated_double_registers();
+ BitVector::Iterator save_iterator(doubles);
+ while (!save_iterator.Done()) {
+ __ sdc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()),
+ MemOperand(sp, count * kDoubleSize));
+ save_iterator.Advance();
+ count++;
+ }
+}
+
+
+void LCodeGen::RestoreCallerDoubles() {
+ ASSERT(info()->saves_caller_doubles());
+ ASSERT(NeedsEagerFrame());
+ Comment(";;; Restore clobbered callee double registers");
+ BitVector* doubles = chunk()->allocated_double_registers();
+ BitVector::Iterator save_iterator(doubles);
+ int count = 0;
+ while (!save_iterator.Done()) {
+ __ ldc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()),
+ MemOperand(sp, count * kDoubleSize));
+ save_iterator.Advance();
+ count++;
+ }
+}
+
+
bool LCodeGen::GeneratePrologue() {
ASSERT(is_generating());
@@ -160,16 +192,7 @@
}
if (info()->saves_caller_doubles()) {
- Comment(";;; Save clobbered callee double registers");
- int count = 0;
- BitVector* doubles = chunk()->allocated_double_registers();
- BitVector::Iterator save_iterator(doubles);
- while (!save_iterator.Done()) {
- __ sdc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()),
- MemOperand(sp, count * kDoubleSize));
- save_iterator.Advance();
- count++;
- }
+ SaveCallerDoubles();
}
// Possibly allocate a local context.
@@ -298,6 +321,7 @@
}
__ li(t9, Operand(ExternalReference::ForDeoptEntry(entry)));
if (deopt_jump_table_[i].needs_frame) {
+ ASSERT(!info()->saves_caller_doubles());
if (needs_frame.is_bound()) {
__ Branch(&needs_frame);
} else {
@@ -313,6 +337,10 @@
__ Call(t9);
}
} else {
+ if (info()->saves_caller_doubles()) {
+ ASSERT(info()->IsStub());
+ RestoreCallerDoubles();
+ }
__ Call(t9);
}
}
@@ -786,7 +814,10 @@
}
ASSERT(info()->IsStub() || frame_is_built_);
- if (condition == al && frame_is_built_) {
+ // Go through jump table if we need to handle condition, build frame, or
+ // restore caller doubles.
+ if (condition == al && frame_is_built_ &&
+ !info()->saves_caller_doubles()) {
__ Call(entry, RelocInfo::RUNTIME_ENTRY, condition, src1, src2);
} else {
// We often have several deopts to the same entry, reuse the last
@@ -2777,16 +2808,7 @@
__ CallRuntime(Runtime::kTraceExit, 1);
}
if (info()->saves_caller_doubles()) {
- ASSERT(NeedsEagerFrame());
- BitVector* doubles = chunk()->allocated_double_registers();
- BitVector::Iterator save_iterator(doubles);
- int count = 0;
- while (!save_iterator.Done()) {
- __ ldc1(DoubleRegister::FromAllocationIndex(save_iterator.Current()),
- MemOperand(sp, count * kDoubleSize));
- save_iterator.Advance();
- count++;
- }
+ RestoreCallerDoubles();
}
int no_frame_start = -1;
if (NeedsEagerFrame()) {
@@ -3851,68 +3873,6 @@
}
-void LCodeGen::DoRandom(LRandom* instr) {
- // Assert that the register size is indeed the size of each seed.
- static const int kSeedSize = sizeof(uint32_t);
- STATIC_ASSERT(kPointerSize == kSeedSize);
-
- // Load native context.
- Register global_object = ToRegister(instr->global_object());
- Register native_context = global_object;
- __ lw(native_context, FieldMemOperand(
- global_object, GlobalObject::kNativeContextOffset));
-
- // Load state (FixedArray of the native context's random seeds).
- static const int kRandomSeedOffset =
- FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize;
- Register state = native_context;
- __ lw(state, FieldMemOperand(native_context, kRandomSeedOffset));
-
- // Load state[0].
- Register state0 = ToRegister(instr->scratch());
- __ lw(state0, FieldMemOperand(state, ByteArray::kHeaderSize));
- // Load state[1].
- Register state1 = ToRegister(instr->scratch2());
- __ lw(state1, FieldMemOperand(state, ByteArray::kHeaderSize + kSeedSize));
-
- // state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16)
- Register scratch3 = ToRegister(instr->scratch3());
- Register scratch4 = scratch0();
- __ And(scratch3, state0, Operand(0xFFFF));
- __ li(scratch4, Operand(18273));
- __ Mul(scratch3, scratch3, scratch4);
- __ srl(state0, state0, 16);
- __ Addu(state0, scratch3, state0);
- // Save state[0].
- __ sw(state0, FieldMemOperand(state, ByteArray::kHeaderSize));
-
- // state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16)
- __ And(scratch3, state1, Operand(0xFFFF));
- __ li(scratch4, Operand(36969));
- __ Mul(scratch3, scratch3, scratch4);
- __ srl(state1, state1, 16),
- __ Addu(state1, scratch3, state1);
- // Save state[1].
- __ sw(state1, FieldMemOperand(state, ByteArray::kHeaderSize + kSeedSize));
-
- // Random bit pattern = (state[0] << 14) + (state[1] & 0x3FFFF)
- Register random = scratch4;
- __ And(random, state1, Operand(0x3FFFF));
- __ sll(state0, state0, 14);
- __ Addu(random, random, state0);
-
- // 0x41300000 is the top half of 1.0 x 2^20 as a double.
- __ li(scratch3, Operand(0x41300000));
- // Move 0x41300000xxxxxxxx (x = random bits in v0) to FPU.
- DoubleRegister result = ToDoubleRegister(instr->result());
- __ Move(result, random, scratch3);
- // Move 0x4130000000000000 to FPU.
- DoubleRegister scratch5 = double_scratch0();
- __ Move(scratch5, zero_reg, scratch3);
- __ sub_d(result, result, scratch5);
-}
-
-
void LCodeGen::DoMathExp(LMathExp* instr) {
DoubleRegister input = ToDoubleRegister(instr->value());
DoubleRegister result = ToDoubleRegister(instr->result());
diff --git a/src/mips/lithium-codegen-mips.h b/src/mips/lithium-codegen-mips.h
index c15352f..9fbd336 100644
--- a/src/mips/lithium-codegen-mips.h
+++ b/src/mips/lithium-codegen-mips.h
@@ -186,6 +186,9 @@
void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); }
+ void SaveCallerDoubles();
+ void RestoreCallerDoubles();
+
// Code generation passes. Returns true if code generation should
// continue.
bool GeneratePrologue();
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
index 5dbef8d..34e5838 100644
--- a/src/mips/lithium-mips.cc
+++ b/src/mips/lithium-mips.cc
@@ -1640,19 +1640,6 @@
}
-LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
- ASSERT(instr->representation().IsDouble());
- ASSERT(instr->global_object()->representation().IsTagged());
- LOperand* global_object = UseTempRegister(instr->global_object());
- LOperand* scratch = TempRegister();
- LOperand* scratch2 = TempRegister();
- LOperand* scratch3 = TempRegister();
- LRandom* result = new(zone()) LRandom(
- global_object, scratch, scratch2, scratch3);
- return DefineFixedDouble(result, f0);
-}
-
-
LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
ASSERT(instr->left()->representation().IsTagged());
ASSERT(instr->right()->representation().IsTagged());
diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h
index 452963b..2996c78 100644
--- a/src/mips/lithium-mips.h
+++ b/src/mips/lithium-mips.h
@@ -154,7 +154,6 @@
V(Parameter) \
V(Power) \
V(PushArgument) \
- V(Random) \
V(RegExpLiteral) \
V(Return) \
V(SeqStringGetChar) \
@@ -1461,28 +1460,6 @@
};
-class LRandom V8_FINAL : public LTemplateInstruction<1, 1, 3> {
- public:
- LRandom(LOperand* global_object,
- LOperand* scratch,
- LOperand* scratch2,
- LOperand* scratch3) {
- inputs_[0] = global_object;
- temps_[0] = scratch;
- temps_[1] = scratch2;
- temps_[2] = scratch3;
- }
-
- LOperand* global_object() const { return inputs_[0]; }
- LOperand* scratch() const { return temps_[0]; }
- LOperand* scratch2() const { return temps_[1]; }
- LOperand* scratch3() const { return temps_[2]; }
-
- DECLARE_CONCRETE_INSTRUCTION(Random, "random")
- DECLARE_HYDROGEN_ACCESSOR(Random)
-};
-
-
class LArithmeticD V8_FINAL : public LTemplateInstruction<1, 2, 0> {
public:
LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
diff --git a/src/mips/macro-assembler-mips.cc b/src/mips/macro-assembler-mips.cc
index cb336f3..04aa9c9 100644
--- a/src/mips/macro-assembler-mips.cc
+++ b/src/mips/macro-assembler-mips.cc
@@ -275,6 +275,12 @@
eq, kWrongAddressOrValuePassedToRecordWrite, at, Operand(value));
}
+ // Count number of write barriers in generated code.
+ isolate()->counters()->write_barriers_static()->Increment();
+ // TODO(mstarzinger): Dynamic counter missing.
+
+ // First, check if a write barrier is even needed. The tests below
+ // catch stores of smis and stores into the young generation.
Label done;
if (smi_check == INLINE_SMI_CHECK) {
@@ -4526,15 +4532,15 @@
// Pre-age the code.
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
nop(Assembler::CODE_AGE_MARKER_NOP);
- // Save the function's original return address
- // (it will be clobbered by Call(t9)).
- mov(at, ra);
- // Load the stub address to t9 and call it.
+ // Load the stub address to t9 and call it,
+ // GetCodeAgeAndParity() extracts the stub address from this instruction.
li(t9,
- Operand(reinterpret_cast<uint32_t>(stub->instruction_start())));
- Call(t9);
- // Record the stub address in the empty space for GetCodeAgeAndParity().
- emit_code_stub_address(stub);
+ Operand(reinterpret_cast<uint32_t>(stub->instruction_start())),
+ CONSTANT_SIZE);
+ nop(); // Prevent jalr to jal optimization.
+ jalr(t9, a0);
+ nop(); // Branch delay slot nop.
+ nop(); // Pad the empty space.
} else {
Push(ra, fp, cp, a1);
nop(Assembler::CODE_AGE_SEQUENCE_NOP);
diff --git a/src/mips/macro-assembler-mips.h b/src/mips/macro-assembler-mips.h
index e9d9f1c..e4187c0 100644
--- a/src/mips/macro-assembler-mips.h
+++ b/src/mips/macro-assembler-mips.h
@@ -1205,8 +1205,10 @@
}
// Convenience function: Same as above, but takes the fid instead.
- void CallRuntime(Runtime::FunctionId id, int num_arguments) {
- CallRuntime(Runtime::FunctionForId(id), num_arguments);
+ void CallRuntime(Runtime::FunctionId id,
+ int num_arguments,
+ SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
+ CallRuntime(Runtime::FunctionForId(id), num_arguments, save_doubles);
}
// Convenience function: call an external reference.
diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc
index 5a96efe..acc6525 100644
--- a/src/mips/simulator-mips.cc
+++ b/src/mips/simulator-mips.cc
@@ -1722,6 +1722,7 @@
int64_t& i64hilo,
uint64_t& u64hilo,
int32_t& next_pc,
+ int32_t& return_addr_reg,
bool& do_interrupt) {
// Every local variable declared here needs to be const.
// This is to make sure that changed values are sent back to
@@ -1782,6 +1783,7 @@
case JR:
case JALR:
next_pc = get_register(instr->RsValue());
+ return_addr_reg = instr->RdValue();
break;
case SLL:
alu_out = rt << sa;
@@ -1986,6 +1988,7 @@
int32_t current_pc = get_pc();
// Next pc
int32_t next_pc = 0;
+ int32_t return_addr_reg = 31;
// Set up the variables if needed before executing the instruction.
ConfigureTypeRegister(instr,
@@ -1993,6 +1996,7 @@
i64hilo,
u64hilo,
next_pc,
+ return_addr_reg,
do_interrupt);
// ---------- Raise exceptions triggered.
@@ -2258,7 +2262,8 @@
Instruction* branch_delay_instr = reinterpret_cast<Instruction*>(
current_pc+Instruction::kInstrSize);
BranchDelayInstructionDecode(branch_delay_instr);
- set_register(31, current_pc + 2 * Instruction::kInstrSize);
+ set_register(return_addr_reg,
+ current_pc + 2 * Instruction::kInstrSize);
set_pc(next_pc);
pc_modified_ = true;
break;
diff --git a/src/mips/simulator-mips.h b/src/mips/simulator-mips.h
index 601cd6d..d9fd10f 100644
--- a/src/mips/simulator-mips.h
+++ b/src/mips/simulator-mips.h
@@ -289,6 +289,7 @@
int64_t& i64hilo,
uint64_t& u64hilo,
int32_t& next_pc,
+ int32_t& return_addr_reg,
bool& do_interrupt);
void DecodeTypeImmediate(Instruction* instr);
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc
index 9b31b4d..a477250 100644
--- a/src/mips/stub-cache-mips.cc
+++ b/src/mips/stub-cache-mips.cc
@@ -1025,9 +1025,10 @@
Label miss_cleanup;
Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label;
Register holder =
- stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
- scratch1, scratch2, scratch3,
- name, depth1, miss);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(object, masm->isolate()), receiver,
+ interceptor_holder, scratch1, scratch2, scratch3,
+ name, depth1, miss);
// Invoke an interceptor and if it provides a value,
// branch to |regular_invoke|.
@@ -1041,10 +1042,10 @@
// Check that the maps from interceptor's holder to constant function's
// holder haven't changed and thus we can use cached constant function.
if (*interceptor_holder != lookup->holder()) {
- stub_compiler_->CheckPrototypes(interceptor_holder, receiver,
- Handle<JSObject>(lookup->holder()),
- scratch1, scratch2, scratch3,
- name, depth2, miss);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(interceptor_holder, masm->isolate()), receiver,
+ handle(lookup->holder()), scratch1, scratch2, scratch3,
+ name, depth2, miss);
} else {
// CheckPrototypes has a side effect of fetching a 'holder'
// for API (object which is instanceof for the signature). It's
@@ -1091,9 +1092,9 @@
Handle<JSObject> interceptor_holder,
Label* miss_label) {
Register holder =
- stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
- scratch1, scratch2, scratch3,
- name, miss_label);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(object, masm->isolate()), receiver,
+ interceptor_holder, scratch1, scratch2, scratch3, name, miss_label);
// Call a runtime function to load the interceptor property.
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -1142,26 +1143,6 @@
};
-void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
- Handle<JSObject> object,
- Handle<JSObject> holder,
- Handle<Name> name,
- Register scratch,
- Label* miss) {
- Handle<JSObject> current = object;
- while (!current.is_identical_to(holder)) {
- if (current->IsJSGlobalObject()) {
- GenerateCheckPropertyCell(masm,
- Handle<JSGlobalObject>::cast(current),
- name,
- scratch,
- miss);
- }
- current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
- }
-}
-
-
void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
__ Jump(code, RelocInfo::CODE_TARGET);
}
@@ -1171,7 +1152,7 @@
#define __ ACCESS_MASM(masm())
-Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
+Register StubCompiler::CheckPrototypes(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
@@ -1181,11 +1162,11 @@
int save_at_depth,
Label* miss,
PrototypeCheckType check) {
+ Handle<Map> receiver_map(IC::TypeToMap(*type, isolate()));
// Make sure that the type feedback oracle harvests the receiver map.
// TODO(svenpanne) Remove this hack when all ICs are reworked.
- __ li(scratch1, Operand(Handle<Map>(object->map())));
+ __ li(scratch1, Operand(receiver_map));
- Handle<JSObject> first = object;
// Make sure there's no overlap between holder and object registers.
ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg)
@@ -1200,25 +1181,31 @@
__ sw(reg, MemOperand(sp, FCA::kHolderIndex * kPointerSize));
}
- // Check the maps in the prototype chain.
- // Traverse the prototype chain from the object and do map checks.
- Handle<JSObject> current = object;
- while (!current.is_identical_to(holder)) {
+ Handle<JSObject> current = Handle<JSObject>::null();
+ if (type->IsConstant()) current = Handle<JSObject>::cast(type->AsConstant());
+ Handle<JSObject> prototype = Handle<JSObject>::null();
+ Handle<Map> current_map = receiver_map;
+ Handle<Map> holder_map(holder->map());
+ // Traverse the prototype chain and check the maps in the prototype chain for
+ // fast and global objects or do negative lookup for normal objects.
+ while (!current_map.is_identical_to(holder_map)) {
++depth;
// Only global objects and objects that do not require access
// checks are allowed in stubs.
- ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
+ ASSERT(current_map->IsJSGlobalProxyMap() ||
+ !current_map->is_access_check_needed());
- Handle<JSObject> prototype(JSObject::cast(current->GetPrototype()));
- if (!current->HasFastProperties() &&
- !current->IsJSGlobalObject() &&
- !current->IsJSGlobalProxy()) {
+ prototype = handle(JSObject::cast(current_map->prototype()));
+ if (current_map->is_dictionary_map() &&
+ !current_map->IsJSGlobalObjectMap() &&
+ !current_map->IsJSGlobalProxyMap()) {
if (!name->IsUniqueName()) {
ASSERT(name->IsString());
name = factory()->InternalizeString(Handle<String>::cast(name));
}
- ASSERT(current->property_dictionary()->FindEntry(*name) ==
+ ASSERT(current.is_null() ||
+ current->property_dictionary()->FindEntry(*name) ==
NameDictionary::kNotFound);
GenerateDictionaryNegativeLookup(masm(), miss, reg, name,
@@ -1229,19 +1216,24 @@
__ lw(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
} else {
Register map_reg = scratch1;
- if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) {
- Handle<Map> current_map(current->map());
+ if (depth != 1 || check == CHECK_ALL_MAPS) {
// CheckMap implicitly loads the map of |reg| into |map_reg|.
__ CheckMap(reg, map_reg, current_map, miss, DONT_DO_SMI_CHECK);
} else {
__ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
}
+
// Check access rights to the global object. This has to happen after
// the map check so that we know that the object is actually a global
// object.
- if (current->IsJSGlobalProxy()) {
+ if (current_map->IsJSGlobalProxyMap()) {
__ CheckAccessGlobalProxy(reg, scratch2, miss);
+ } else if (current_map->IsJSGlobalObjectMap()) {
+ GenerateCheckPropertyCell(
+ masm(), Handle<JSGlobalObject>::cast(current), name,
+ scratch2, miss);
}
+
reg = holder_reg; // From now on the object will be in holder_reg.
if (heap()->InNewSpace(*prototype)) {
@@ -1260,28 +1252,24 @@
// Go to the next object in the prototype chain.
current = prototype;
+ current_map = handle(current->map());
}
// Log the check depth.
LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
- if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) {
+ if (depth != 0 || check == CHECK_ALL_MAPS) {
// Check the holder map.
- __ CheckMap(reg, scratch1, Handle<Map>(holder->map()), miss,
- DONT_DO_SMI_CHECK);
+ __ CheckMap(reg, scratch1, current_map, miss, DONT_DO_SMI_CHECK);
}
// Perform security check for access to the global object.
- ASSERT(holder->IsJSGlobalProxy() || !holder->IsAccessCheckNeeded());
- if (holder->IsJSGlobalProxy()) {
+ ASSERT(current_map->IsJSGlobalProxyMap() ||
+ !current_map->is_access_check_needed());
+ if (current_map->IsJSGlobalProxyMap()) {
__ CheckAccessGlobalProxy(reg, scratch1, miss);
}
- // If we've skipped any global objects, it's not enough to verify that
- // their maps haven't changed. We also need to check that the property
- // cell for the property is still empty.
- GenerateCheckPropertyCells(masm(), object, holder, name, scratch1, miss);
-
// Return the register containing the holder.
return reg;
}
@@ -1310,14 +1298,14 @@
Register LoadStubCompiler::CallbackHandlerFrontend(
- Handle<Object> object,
+ Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
- Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
+ Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
ASSERT(!reg.is(scratch2()));
@@ -1564,7 +1552,8 @@
// Check that the maps haven't changed.
__ JumpIfSmi(a0, miss);
- CheckPrototypes(object, a0, holder, a3, a1, t0, name, miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()), a0, holder, a3, a1, t0, name, miss);
}
@@ -1626,7 +1615,9 @@
__ JumpIfSmi(a0, &miss, t0);
// Do the right check and compute the holder register.
- Register reg = CheckPrototypes(object, a0, holder, a1, a3, t0, name, &miss);
+ Register reg = CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ a0, holder, a1, a3, t0, name, &miss);
GenerateFastPropertyLoad(masm(), a1, reg, index.is_inobject(holder),
index.translate(holder), Representation::Tagged());
@@ -1662,8 +1653,9 @@
__ JumpIfSmi(receiver, &miss);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, a3, a0,
- t0, name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()), receiver, holder,
+ a3, a0, t0, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -1725,8 +1717,9 @@
__ JumpIfSmi(receiver, &miss);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, a3, v0, t0,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()), receiver, holder,
+ a3, v0, t0, name, &miss);
if (argc == 0) {
// Nothing to do, just return the length.
@@ -1982,8 +1975,9 @@
__ JumpIfSmi(receiver, &miss);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), receiver, holder, elements,
- t0, v0, name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()), receiver, holder,
+ elements, t0, v0, name, &miss);
// Get the elements array of the object.
__ lw(elements, FieldMemOperand(receiver, JSArray::kElementsOffset));
@@ -2074,8 +2068,9 @@
v0,
&miss);
ASSERT(!object.is_identical_to(holder));
+ Handle<JSObject> prototype(JSObject::cast(object->GetPrototype(isolate())));
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
v0, holder, a1, a3, t0, name, &miss);
Register receiver = a1;
@@ -2154,8 +2149,9 @@
v0,
&miss);
ASSERT(!object.is_identical_to(holder));
+ Handle<JSObject> prototype(JSObject::cast(object->GetPrototype(isolate())));
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
v0, holder, a1, a3, t0, name, &miss);
Register receiver = v0;
@@ -2230,8 +2226,9 @@
STATIC_ASSERT(kSmiTag == 0);
__ JumpIfSmi(a1, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), a1, holder, v0, a3, t0,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ a1, holder, v0, a3, t0, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2302,8 +2299,9 @@
__ lw(a1, MemOperand(sp, 1 * kPointerSize));
STATIC_ASSERT(kSmiTag == 0);
__ JumpIfSmi(a1, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), a1, holder, a0, a3, t0,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ a1, holder, a0, a3, t0, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2431,8 +2429,9 @@
__ lw(a1, MemOperand(sp, 1 * kPointerSize));
STATIC_ASSERT(kSmiTag == 0);
__ JumpIfSmi(a1, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), a1, holder, v0, a3, t0,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ a1, holder, v0, a3, t0, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2541,8 +2540,9 @@
ReserveSpaceForFastApiCall(masm(), a0);
// Check that the maps haven't changed and find a Holder as a side effect.
- CheckPrototypes(Handle<JSObject>::cast(object), a1, holder, a0, a3, t0, name,
- depth, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ a1, holder, a0, a3, t0, name, depth, &miss);
GenerateFastApiDirectCall(masm(), optimization, argc, false);
@@ -2596,8 +2596,9 @@
__ IncrementCounter(isolate()->counters()->call_const(), 1, a0, a3);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), a1, holder, a0, a3, t0,
- name, &miss);
+ CheckPrototypes(
+ IC::CurrentTypeOf(object, isolate()),
+ a1, holder, a0, a3, t0, name, &miss);
// Patch the receiver on the stack with the global proxy if
// necessary.
@@ -2607,30 +2608,32 @@
}
break;
- case STRING_CHECK:
+ case STRING_CHECK: {
// Check that the object is a string.
__ GetObjectType(a1, a3, a3);
__ Branch(&miss, Ugreater_equal, a3, Operand(FIRST_NONSTRING_TYPE));
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::STRING_FUNCTION_INDEX, a0, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
a0, holder, a3, a1, t0, name, &miss);
break;
-
- case SYMBOL_CHECK:
+ }
+ case SYMBOL_CHECK: {
// Check that the object is a symbol.
__ GetObjectType(a1, a1, a3);
__ Branch(&miss, ne, a3, Operand(SYMBOL_TYPE));
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::SYMBOL_FUNCTION_INDEX, a0, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
a0, holder, a3, a1, t0, name, &miss);
break;
-
+ }
case NUMBER_CHECK: {
Label fast;
// Check that the object is a smi or a heap number.
@@ -2641,8 +2644,9 @@
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::NUMBER_FUNCTION_INDEX, a0, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
a0, holder, a3, a1, t0, name, &miss);
break;
}
@@ -2652,8 +2656,9 @@
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::BOOLEAN_FUNCTION_INDEX, a0, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
a0, holder, a3, a1, t0, name, &miss);
break;
}
@@ -2810,7 +2815,8 @@
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
// Stub never generated for non-global objects that require access
// checks.
@@ -2837,7 +2843,8 @@
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
Register values[] = { value() };
GenerateFastApiCall(
@@ -2932,12 +2939,10 @@
}
-Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
- Handle<Object> object,
- Handle<JSObject> last,
- Handle<Name> name,
- Handle<JSGlobalObject> global) {
- NonexistentHandlerFrontend(object, last, name, global);
+Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
+ Handle<JSObject> last,
+ Handle<Name> name) {
+ NonexistentHandlerFrontend(type, last, name);
// Return undefined if maps of the full prototype chain is still the same.
__ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
@@ -3030,14 +3035,14 @@
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
- Handle<Object> object,
+ Handle<Type> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
bool is_dont_delete) {
Label miss;
- HandlerFrontendHeader(object, receiver(), global, name, &miss);
+ HandlerFrontendHeader(type, receiver(), global, name, &miss);
// Get the value from the cell.
__ li(a3, Operand(cell));
diff --git a/src/mksnapshot.cc b/src/mksnapshot.cc
index acd4525..457f7b3 100644
--- a/src/mksnapshot.cc
+++ b/src/mksnapshot.cc
@@ -332,7 +332,7 @@
i += read;
}
fclose(file);
- Local<String> source = String::New(chars);
+ Local<String> source = String::NewFromUtf8(isolate, chars);
TryCatch try_catch;
Local<Script> script = Script::Compile(source);
if (try_catch.HasCaught()) {
@@ -358,7 +358,7 @@
internal_isolate->heap()->CollectAllGarbage(
i::Heap::kNoGCFlags, "mksnapshot");
i::Object* raw_context = *v8::Utils::OpenPersistent(context);
- context.Dispose();
+ context.Reset();
CppByteSink sink(argv[1]);
// This results in a somewhat smaller snapshot, probably because it gets rid
// of some things that are cached between garbage collections.
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 7064ea9..6e2ad06 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -5459,6 +5459,16 @@
}
+bool JSArrayBuffer::should_be_freed() {
+ return BooleanBit::get(flag(), kShouldBeFreed);
+}
+
+
+void JSArrayBuffer::set_should_be_freed(bool value) {
+ set_flag(BooleanBit::set(flag(), kShouldBeFreed, value));
+}
+
+
ACCESSORS(JSArrayBuffer, weak_next, Object, kWeakNextOffset)
ACCESSORS(JSArrayBuffer, weak_first_view, Object, kWeakFirstViewOffset)
diff --git a/src/objects.cc b/src/objects.cc
index 2b38b1d..2283581 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10402,6 +10402,18 @@
}
+void Code::InvalidateEmbeddedObjects() {
+ Object* undefined = GetHeap()->undefined_value();
+ int mode_mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT);
+ for (RelocIterator it(this, mode_mask); !it.done(); it.next()) {
+ RelocInfo::Mode mode = it.rinfo()->rmode();
+ if (mode == RelocInfo::EMBEDDED_OBJECT) {
+ it.rinfo()->set_target_object(undefined, SKIP_WRITE_BARRIER);
+ }
+ }
+}
+
+
void Code::Relocate(intptr_t delta) {
for (RelocIterator it(this, RelocInfo::kApplyMask); !it.done(); it.next()) {
it.rinfo()->apply(delta);
diff --git a/src/objects.h b/src/objects.h
index cf4c80b..93d35bf 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5054,6 +5054,7 @@
// [relocation_info]: Code relocation information
DECL_ACCESSORS(relocation_info, ByteArray)
void InvalidateRelocation();
+ void InvalidateEmbeddedObjects();
// [handler_table]: Fixed array containing offsets of exception handlers.
DECL_ACCESSORS(handler_table, FixedArray)
@@ -6197,6 +6198,16 @@
bool IsJSObjectMap() {
return instance_type() >= FIRST_JS_OBJECT_TYPE;
}
+ bool IsJSGlobalProxyMap() {
+ return instance_type() == JS_GLOBAL_PROXY_TYPE;
+ }
+ bool IsJSGlobalObjectMap() {
+ return instance_type() == JS_GLOBAL_OBJECT_TYPE;
+ }
+ bool IsGlobalObjectMap() {
+ const InstanceType type = instance_type();
+ return type == JS_GLOBAL_OBJECT_TYPE || type == JS_BUILTINS_OBJECT_TYPE;
+ }
// Fires when the layout of an object with a leaf map changes.
// This includes adding transitions to the leaf map or changing
@@ -6507,7 +6518,6 @@
V(Math, exp, MathExp) \
V(Math, sqrt, MathSqrt) \
V(Math, pow, MathPow) \
- V(Math, random, MathRandom) \
V(Math, max, MathMax) \
V(Math, min, MathMin) \
V(Math, imul, MathImul)
@@ -9630,6 +9640,9 @@
inline bool is_external();
inline void set_is_external(bool value);
+ inline bool should_be_freed();
+ inline void set_should_be_freed(bool value);
+
// [weak_next]: linked list of array buffers.
DECL_ACCESSORS(weak_next, Object)
@@ -9659,6 +9672,7 @@
private:
// Bit position in a flag
static const int kIsExternalBit = 0;
+ static const int kShouldBeFreed = 1;
DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
};
diff --git a/src/platform-freebsd.cc b/src/platform-freebsd.cc
index 103fd6c..75d88ec 100644
--- a/src/platform-freebsd.cc
+++ b/src/platform-freebsd.cc
@@ -182,7 +182,7 @@
// There may be no filename in this line. Skip to next.
if (start_of_path == NULL) continue;
buffer[bytes_read] = 0;
- LOG(isolate SharedLibraryEvent(start_of_path, start, end));
+ LOG(isolate, SharedLibraryEvent(start_of_path, start, end));
}
close(fd);
}
diff --git a/src/runtime.cc b/src/runtime.cc
index c11a005..092e91e 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -694,6 +694,10 @@
void Runtime::FreeArrayBuffer(Isolate* isolate,
JSArrayBuffer* phantom_array_buffer) {
+ if (phantom_array_buffer->should_be_freed()) {
+ ASSERT(phantom_array_buffer->is_external());
+ free(phantom_array_buffer->backing_store());
+ }
if (phantom_array_buffer->is_external()) return;
size_t allocated_length = NumberToSize(
diff --git a/src/runtime.h b/src/runtime.h
index 0e09200..43d4065 100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -622,7 +622,6 @@
F(OneByteSeqStringSetChar, 3, 1) \
F(TwoByteSeqStringSetChar, 3, 1) \
F(ObjectEquals, 2, 1) \
- F(RandomHeapNumber, 0, 1) \
F(IsObject, 1, 1) \
F(IsFunction, 1, 1) \
F(IsUndetectableObject, 1, 1) \
diff --git a/src/serialize.cc b/src/serialize.cc
index 36e19c1..a8df238 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -297,10 +297,6 @@
RUNTIME_ENTRY,
1,
"Runtime::PerformGC");
- Add(ExternalReference::random_uint32_function(isolate).address(),
- RUNTIME_ENTRY,
- 3,
- "V8::Random");
Add(ExternalReference::delete_handle_scope_extensions(isolate).address(),
RUNTIME_ENTRY,
4,
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index 6fdd6d9..06edc0d 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -100,21 +100,20 @@
Handle<Code> StubCache::FindIC(Handle<Name> name,
- Handle<Map> stub_holder_map,
+ Handle<Map> stub_holder,
Code::Kind kind,
Code::ExtraICState extra_state,
InlineCacheHolderFlag cache_holder) {
Code::Flags flags = Code::ComputeMonomorphicFlags(
kind, extra_state, cache_holder);
- Handle<Object> probe(stub_holder_map->FindInCodeCache(*name, flags),
- isolate_);
+ Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_);
if (probe->IsCode()) return Handle<Code>::cast(probe);
return Handle<Code>::null();
}
Handle<Code> StubCache::FindHandler(Handle<Name> name,
- Handle<HeapObject> stub_holder,
+ Handle<Map> stub_holder,
Code::Kind kind,
InlineCacheHolderFlag cache_holder,
StrictModeFlag strict_mode) {
@@ -126,8 +125,7 @@
Code::Flags flags = Code::ComputeMonomorphicFlags(
Code::HANDLER, extra_ic_state, cache_holder, Code::NORMAL, kind);
- Handle<Object> probe(stub_holder->map()->FindInCodeCache(*name, flags),
- isolate_);
+ Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_);
if (probe->IsCode()) return Handle<Code>::cast(probe);
return Handle<Code>::null();
}
@@ -173,41 +171,35 @@
Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name,
- Handle<Object> object) {
- InlineCacheHolderFlag cache_holder = IC::GetCodeCacheForObject(*object);
- Handle<HeapObject> stub_holder(IC::GetCodeCacheHolder(
- isolate(), *object, cache_holder));
- // If no global objects are present in the prototype chain, the load
- // nonexistent IC stub can be shared for all names for a given map
- // and we use the empty string for the map cache in that case. If
- // there are global objects involved, we need to check global
- // property cells in the stub and therefore the stub will be
- // specific to the name.
- Handle<Name> cache_name = factory()->empty_string();
- Handle<JSObject> current;
- Handle<Object> next = stub_holder;
- Handle<JSGlobalObject> global;
- do {
- current = Handle<JSObject>::cast(next);
- next = Handle<Object>(current->GetPrototype(), isolate_);
- if (current->IsJSGlobalObject()) {
- global = Handle<JSGlobalObject>::cast(current);
- cache_name = name;
- } else if (!current->HasFastProperties()) {
- cache_name = name;
- }
- } while (!next->IsNull());
+ Handle<Type> type) {
+ InlineCacheHolderFlag flag = IC::GetCodeCacheFlag(*type);
+ Handle<Map> stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate());
+ // If no dictionary mode objects are present in the prototype chain, the load
+ // nonexistent IC stub can be shared for all names for a given map and we use
+ // the empty string for the map cache in that case. If there are dictionary
+ // mode objects involved, we need to do negative lookups in the stub and
+ // therefore the stub will be specific to the name.
+ Handle<Map> current_map = stub_holder;
+ Handle<Name> cache_name = current_map->is_dictionary_map()
+ ? name : Handle<Name>::cast(isolate()->factory()->empty_string());
+ Handle<Object> next(current_map->prototype(), isolate());
+ Handle<JSObject> last = Handle<JSObject>::null();
+ while (!next->IsNull()) {
+ last = Handle<JSObject>::cast(next);
+ next = handle(current_map->prototype(), isolate());
+ current_map = handle(Handle<HeapObject>::cast(next)->map());
+ if (current_map->is_dictionary_map()) cache_name = name;
+ }
// Compile the stub that is either shared for all names or
// name specific if there are global objects involved.
Handle<Code> handler = FindHandler(
- cache_name, stub_holder, Code::LOAD_IC, cache_holder);
+ cache_name, stub_holder, Code::LOAD_IC, flag);
if (!handler.is_null()) return handler;
- LoadStubCompiler compiler(isolate_, cache_holder);
- handler =
- compiler.CompileLoadNonexistent(object, current, cache_name, global);
- HeapObject::UpdateMapCodeCache(stub_holder, cache_name, handler);
+ LoadStubCompiler compiler(isolate_, flag);
+ handler = compiler.CompileLoadNonexistent(type, last, cache_name);
+ Map::UpdateCodeCache(stub_holder, cache_name, handler);
return handler;
}
@@ -1135,56 +1127,54 @@
Register LoadStubCompiler::HandlerFrontendHeader(
- Handle<Object> object,
+ Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Label* miss) {
- Handle<JSObject> receiver;
PrototypeCheckType check_type = CHECK_ALL_MAPS;
int function_index = -1;
- if (object->IsJSObject()) {
- receiver = Handle<JSObject>::cast(object);
- check_type = SKIP_RECEIVER;
+ if (type->Is(Type::String())) {
+ function_index = Context::STRING_FUNCTION_INDEX;
+ } else if (type->Is(Type::Symbol())) {
+ function_index = Context::SYMBOL_FUNCTION_INDEX;
+ } else if (type->Is(Type::Number())) {
+ function_index = Context::NUMBER_FUNCTION_INDEX;
+ } else if (type->Is(Type::Boolean())) {
+ // Booleans use the generic oddball map, so an additional check is needed to
+ // ensure the receiver is really a boolean.
+ GenerateBooleanCheck(object_reg, miss);
+ function_index = Context::BOOLEAN_FUNCTION_INDEX;
} else {
- if (object->IsString()) {
- function_index = Context::STRING_FUNCTION_INDEX;
- } else if (object->IsSymbol()) {
- function_index = Context::SYMBOL_FUNCTION_INDEX;
- } else if (object->IsNumber()) {
- function_index = Context::NUMBER_FUNCTION_INDEX;
- } else {
- ASSERT(object->IsBoolean());
- // Booleans use the generic oddball map, so an additional check is
- // needed to ensure the receiver is really a boolean.
- GenerateBooleanCheck(object_reg, miss);
- function_index = Context::BOOLEAN_FUNCTION_INDEX;
- }
+ check_type = SKIP_RECEIVER;
+ }
+ if (check_type == CHECK_ALL_MAPS) {
GenerateDirectLoadGlobalFunctionPrototype(
masm(), function_index, scratch1(), miss);
- receiver = handle(JSObject::cast(object->GetPrototype(isolate())));
+ Object* function = isolate()->native_context()->get(function_index);
+ Object* prototype = JSFunction::cast(function)->instance_prototype();
+ type = IC::CurrentTypeOf(handle(prototype, isolate()), isolate());
object_reg = scratch1();
}
// Check that the maps starting from the prototype haven't changed.
- return CheckPrototypes(receiver, object_reg, holder,
- scratch1(), scratch2(), scratch3(),
- name, miss, check_type);
+ return CheckPrototypes(
+ type, object_reg, holder, scratch1(), scratch2(), scratch3(),
+ name, miss, check_type);
}
// HandlerFrontend for store uses the name register. It has to be restored
// before a miss.
Register StoreStubCompiler::HandlerFrontendHeader(
- Handle<Object> object,
+ Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Label* miss) {
- return CheckPrototypes(Handle<JSObject>::cast(object), object_reg, holder,
- this->name(), scratch1(), scratch2(),
- name, miss, SKIP_RECEIVER);
+ return CheckPrototypes(type, object_reg, holder, this->name(),
+ scratch1(), scratch2(), name, miss, SKIP_RECEIVER);
}
@@ -1196,13 +1186,13 @@
}
-Register BaseLoadStoreStubCompiler::HandlerFrontend(Handle<Object> object,
+Register BaseLoadStoreStubCompiler::HandlerFrontend(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name) {
Label miss;
- Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
+ Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
HandlerFrontendFooter(name, &miss);
@@ -1210,32 +1200,43 @@
}
-void LoadStubCompiler::NonexistentHandlerFrontend(
- Handle<Object> object,
- Handle<JSObject> last,
- Handle<Name> name,
- Handle<JSGlobalObject> global) {
+void LoadStubCompiler::NonexistentHandlerFrontend(Handle<Type> type,
+ Handle<JSObject> last,
+ Handle<Name> name) {
Label miss;
- Register holder = HandlerFrontendHeader(
- object, receiver(), last, name, &miss);
+ Register holder;
+ Handle<Map> last_map;
+ if (last.is_null()) {
+ holder = receiver();
+ last_map = IC::TypeToMap(*type, isolate());
+ // If |type| has null as its prototype, |last| is Handle<JSObject>::null().
+ ASSERT(last_map->prototype() == isolate()->heap()->null_value());
+ } else {
+ holder = HandlerFrontendHeader(type, receiver(), last, name, &miss);
+ last_map = handle(last->map());
+ }
- if (!last->HasFastProperties() &&
- !last->IsJSGlobalObject() &&
- !last->IsJSGlobalProxy()) {
+ if (last_map->is_dictionary_map() &&
+ !last_map->IsJSGlobalObjectMap() &&
+ !last_map->IsJSGlobalProxyMap()) {
if (!name->IsUniqueName()) {
ASSERT(name->IsString());
name = factory()->InternalizeString(Handle<String>::cast(name));
}
- ASSERT(last->property_dictionary()->FindEntry(*name) ==
- NameDictionary::kNotFound);
+ ASSERT(last.is_null() ||
+ last->property_dictionary()->FindEntry(*name) ==
+ NameDictionary::kNotFound);
GenerateDictionaryNegativeLookup(masm(), &miss, holder, name,
scratch2(), scratch3());
}
// If the last object in the prototype chain is a global object,
// check that the global property cell is empty.
- if (!global.is_null()) {
+ if (last_map->IsJSGlobalObjectMap()) {
+ Handle<JSGlobalObject> global = last.is_null()
+ ? Handle<JSGlobalObject>::cast(type->AsConstant())
+ : Handle<JSGlobalObject>::cast(last);
GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
}
@@ -1244,14 +1245,14 @@
Handle<Code> LoadStubCompiler::CompileLoadField(
- Handle<Object> object,
+ Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
PropertyIndex field,
Representation representation) {
Label miss;
- Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss);
+ Register reg = HandlerFrontendHeader(type, receiver(), holder, name, &miss);
GenerateLoadField(reg, holder, field, representation);
@@ -1264,11 +1265,11 @@
Handle<Code> LoadStubCompiler::CompileLoadConstant(
- Handle<Object> object,
+ Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> value) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(type, receiver(), holder, name);
GenerateLoadConstant(value);
// Return the generated code.
@@ -1277,12 +1278,12 @@
Handle<Code> LoadStubCompiler::CompileLoadCallback(
- Handle<Object> object,
+ Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
Register reg = CallbackHandlerFrontend(
- object, receiver(), holder, name, callback);
+ type, receiver(), holder, name, callback);
GenerateLoadCallback(reg, callback);
// Return the generated code.
@@ -1291,13 +1292,13 @@
Handle<Code> LoadStubCompiler::CompileLoadCallback(
- Handle<Object> object,
+ Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
ASSERT(call_optimization.is_simple_api_call());
Handle<JSFunction> callback = call_optimization.constant_function();
- CallbackHandlerFrontend(object, receiver(), holder, name, callback);
+ CallbackHandlerFrontend(type, receiver(), holder, name, callback);
GenerateLoadCallback(call_optimization);
// Return the generated code.
@@ -1306,16 +1307,16 @@
Handle<Code> LoadStubCompiler::CompileLoadInterceptor(
- Handle<Object> object,
+ Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name) {
LookupResult lookup(isolate());
LookupPostInterceptor(holder, name, &lookup);
- Register reg = HandlerFrontend(object, receiver(), holder, name);
+ Register reg = HandlerFrontend(type, receiver(), holder, name);
// TODO(368): Compile in the whole chain: all the interceptors in
// prototypes and ultimate answer.
- GenerateLoadInterceptor(reg, object, holder, &lookup, name);
+ GenerateLoadInterceptor(reg, type, holder, &lookup, name);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
@@ -1337,7 +1338,8 @@
// We found FIELD property in prototype chain of interceptor's holder.
// Retrieve a field from field's holder.
Register reg = HandlerFrontend(
- interceptor_holder, interceptor_reg, holder, name);
+ IC::CurrentTypeOf(interceptor_holder, isolate()),
+ interceptor_reg, holder, name);
GenerateLoadField(
reg, holder, field, lookup->representation());
}
@@ -1350,7 +1352,8 @@
ASSERT(callback->getter() != NULL);
Register reg = CallbackHandlerFrontend(
- interceptor_holder, interceptor_reg, holder, name, callback);
+ IC::CurrentTypeOf(interceptor_holder, isolate()),
+ interceptor_reg, holder, name, callback);
GenerateLoadCallback(reg, callback);
}
}
@@ -1370,11 +1373,11 @@
Handle<Code> LoadStubCompiler::CompileLoadViaGetter(
- Handle<Object> object,
+ Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<JSFunction> getter) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(type, receiver(), holder, name);
GenerateLoadViaGetter(masm(), receiver(), getter);
// Return the generated code.
@@ -1406,8 +1409,8 @@
} while (holder->GetPrototype()->IsJSObject());
}
- Register holder_reg =
- HandlerFrontendHeader(object, receiver(), holder, name, &miss);
+ Register holder_reg = HandlerFrontendHeader(
+ IC::CurrentTypeOf(object, isolate()), receiver(), holder, name, &miss);
// If no property was found, and the holder (the last object in the
// prototype chain) is in slow mode, we need to do a negative lookup on the
@@ -1444,7 +1447,8 @@
Handle<Name> name) {
Label miss;
- HandlerFrontendHeader(object, receiver(), object, name, &miss);
+ HandlerFrontendHeader(IC::CurrentTypeOf(object, isolate()),
+ receiver(), object, name, &miss);
// Generate store field code.
GenerateStoreField(masm(),
@@ -1467,7 +1471,8 @@
Handle<JSObject> holder,
Handle<Name> name,
Handle<JSFunction> setter) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
GenerateStoreViaSetter(masm(), setter);
return GetCode(kind(), Code::FAST, name);
diff --git a/src/stub-cache.h b/src/stub-cache.h
index 91f3409..199fca5 100644
--- a/src/stub-cache.h
+++ b/src/stub-cache.h
@@ -87,7 +87,7 @@
InlineCacheHolderFlag cache_holder = OWN_MAP);
Handle<Code> FindHandler(Handle<Name> name,
- Handle<HeapObject> stub_holder,
+ Handle<Map> map,
Code::Kind kind,
InlineCacheHolderFlag cache_holder = OWN_MAP,
StrictModeFlag strict_mode = kNonStrictMode);
@@ -97,7 +97,7 @@
Handle<Code> handler,
StrictModeFlag strict_mode);
- Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Object> object);
+ Handle<Code> ComputeLoadNonexistent(Handle<Name> name, Handle<Type> type);
Handle<Code> ComputeKeyedLoadElement(Handle<Map> receiver_map);
@@ -443,15 +443,6 @@
Register scratch,
Label* miss);
- // Calls GenerateCheckPropertyCell for each global object in the prototype
- // chain from object to (but not including) holder.
- static void GenerateCheckPropertyCells(MacroAssembler* masm,
- Handle<JSObject> object,
- Handle<JSObject> holder,
- Handle<Name> name,
- Register scratch,
- Label* miss);
-
static void TailCallBuiltin(MacroAssembler* masm, Builtins::Name name);
// Generates code that verifies that the property holder has not changed
@@ -469,7 +460,7 @@
// The function can optionally (when save_at_depth !=
// kInvalidProtoDepth) save the object at the given depth by moving
// it to [esp + kPointerSize].
- Register CheckPrototypes(Handle<JSObject> object,
+ Register CheckPrototypes(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
@@ -478,11 +469,11 @@
Handle<Name> name,
Label* miss,
PrototypeCheckType check = CHECK_ALL_MAPS) {
- return CheckPrototypes(object, object_reg, holder, holder_reg, scratch1,
+ return CheckPrototypes(type, object_reg, holder, holder_reg, scratch1,
scratch2, name, kInvalidProtoDepth, miss, check);
}
- Register CheckPrototypes(Handle<JSObject> object,
+ Register CheckPrototypes(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
@@ -558,7 +549,7 @@
}
protected:
- virtual Register HandlerFrontendHeader(Handle<Object> object,
+ virtual Register HandlerFrontendHeader(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
@@ -566,7 +557,7 @@
virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss) = 0;
- Register HandlerFrontend(Handle<Object> object,
+ Register HandlerFrontend(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name);
@@ -624,32 +615,32 @@
: BaseLoadStoreStubCompiler(isolate, kind, cache_holder) { }
virtual ~LoadStubCompiler() { }
- Handle<Code> CompileLoadField(Handle<Object> object,
+ Handle<Code> CompileLoadField(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
PropertyIndex index,
Representation representation);
- Handle<Code> CompileLoadCallback(Handle<Object> object,
+ Handle<Code> CompileLoadCallback(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback);
- Handle<Code> CompileLoadCallback(Handle<Object> object,
+ Handle<Code> CompileLoadCallback(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization);
- Handle<Code> CompileLoadConstant(Handle<Object> object,
+ Handle<Code> CompileLoadConstant(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> value);
- Handle<Code> CompileLoadInterceptor(Handle<Object> object,
+ Handle<Code> CompileLoadInterceptor(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name);
- Handle<Code> CompileLoadViaGetter(Handle<Object> object,
+ Handle<Code> CompileLoadViaGetter(Handle<Type> type,
Handle<JSObject> holder,
Handle<Name> name,
Handle<JSFunction> getter);
@@ -658,12 +649,11 @@
Register receiver,
Handle<JSFunction> getter);
- Handle<Code> CompileLoadNonexistent(Handle<Object> object,
+ Handle<Code> CompileLoadNonexistent(Handle<Type> type,
Handle<JSObject> last,
- Handle<Name> name,
- Handle<JSGlobalObject> global);
+ Handle<Name> name);
- Handle<Code> CompileLoadGlobal(Handle<Object> object,
+ Handle<Code> CompileLoadGlobal(Handle<Type> type,
Handle<GlobalObject> holder,
Handle<PropertyCell> cell,
Handle<Name> name,
@@ -672,7 +662,7 @@
static Register* registers();
protected:
- virtual Register HandlerFrontendHeader(Handle<Object> object,
+ virtual Register HandlerFrontendHeader(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
@@ -680,15 +670,14 @@
virtual void HandlerFrontendFooter(Handle<Name> name, Label* miss);
- Register CallbackHandlerFrontend(Handle<Object> object,
+ Register CallbackHandlerFrontend(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback);
- void NonexistentHandlerFrontend(Handle<Object> object,
+ void NonexistentHandlerFrontend(Handle<Type> type,
Handle<JSObject> last,
- Handle<Name> name,
- Handle<JSGlobalObject> global);
+ Handle<Name> name);
void GenerateLoadField(Register reg,
Handle<JSObject> holder,
@@ -821,7 +810,7 @@
}
protected:
- virtual Register HandlerFrontendHeader(Handle<Object> object,
+ virtual Register HandlerFrontendHeader(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
diff --git a/src/types.cc b/src/types.cc
index 9c576c0..485ba88 100644
--- a/src/types.cc
+++ b/src/types.cc
@@ -244,7 +244,7 @@
// Most precise _current_ type of a value (usually its class).
-Type* Type::CurrentOf(Handle<i::Object> value) {
+Type* Type::OfCurrently(Handle<i::Object> value) {
if (value->IsSmi()) return Smi();
i::Map* map = i::HeapObject::cast(*value)->map();
if (map->instance_type() == HEAP_NUMBER_TYPE ||
@@ -297,6 +297,14 @@
}
+bool Type::IsCurrently(Type* that) {
+ return this->Is(that) ||
+ (this->is_constant() && that->is_class() &&
+ this->as_constant()->IsHeapObject() &&
+ i::HeapObject::cast(*this->as_constant())->map() == *that->as_class());
+}
+
+
// Check this overlaps that.
bool Type::Maybe(Type* that) {
// Fast path for bitsets.
@@ -525,25 +533,35 @@
}
+const char* Type::bitset_name(int bitset) {
+ switch (bitset) {
+ #define PRINT_COMPOSED_TYPE(type, value) case k##type: return #type;
+ BITSET_TYPE_LIST(PRINT_COMPOSED_TYPE)
+ #undef PRINT_COMPOSED_TYPE
+ default:
+ return NULL;
+ }
+}
+
+
void Type::TypePrint(FILE* out) {
if (is_bitset()) {
- int val = as_bitset();
- const char* composed_name = GetComposedName(val);
- if (composed_name != NULL) {
- PrintF(out, "%s", composed_name);
- return;
- }
- bool first_entry = true;
- PrintF(out, "{");
- for (unsigned i = 0; i < sizeof(val)*8; ++i) {
- int mask = (1 << i);
- if ((val & mask) != 0) {
- if (!first_entry) PrintF(out, ",");
- first_entry = false;
- PrintF(out, "%s", GetPrimitiveName(mask));
+ int bitset = as_bitset();
+ const char* name = bitset_name(bitset);
+ if (name != NULL) {
+ PrintF(out, "%s", name);
+ } else {
+ bool is_first = true;
+ PrintF(out, "(");
+ for (int mask = 1; mask != 0; mask = mask << 1) {
+ if ((bitset & mask) != 0) {
+ if (!is_first) PrintF(out, " | ");
+ is_first = false;
+ PrintF(out, "%s", bitset_name(mask));
+ }
}
+ PrintF(out, ")");
}
- PrintF(out, "}");
} else if (is_constant()) {
PrintF(out, "Constant(%p : ", static_cast<void*>(*as_constant()));
from_bitset(LubBitset())->TypePrint(out);
@@ -553,14 +571,14 @@
from_bitset(LubBitset())->TypePrint(out);
PrintF(")");
} else if (is_union()) {
- PrintF(out, "{");
+ PrintF(out, "(");
Handle<Unioned> unioned = as_union();
for (int i = 0; i < unioned->length(); ++i) {
Handle<Type> type_i = union_get(unioned, i);
- if (i > 0) PrintF(out, ",");
+ if (i > 0) PrintF(out, " | ");
type_i->TypePrint(out);
}
- PrintF(out, "}");
+ PrintF(out, ")");
}
}
#endif
diff --git a/src/types.h b/src/types.h
index 2e21a9e..1dc79dd 100644
--- a/src/types.h
+++ b/src/types.h
@@ -95,7 +95,7 @@
// a concurrent compilation context.
-#define PRIMITIVE_TYPE_LIST(V) \
+#define BITSET_TYPE_LIST(V) \
V(None, 0) \
V(Null, 1 << 0) \
V(Undefined, 1 << 1) \
@@ -113,9 +113,8 @@
V(RegExp, 1 << 13) \
V(OtherObject, 1 << 14) \
V(Proxy, 1 << 15) \
- V(Internal, 1 << 16)
-
-#define COMPOSED_TYPE_LIST(V) \
+ V(Internal, 1 << 16) \
+ \
V(Oddball, kBoolean | kNull | kUndefined) \
V(Signed32, kSmi | kOtherSigned32) \
V(Number, kSigned32 | kUnsigned32 | kDouble) \
@@ -131,17 +130,12 @@
V(NonNumber, kAny - kNumber) \
V(Detectable, kAllocated - kUndetectable)
-#define TYPE_LIST(V) \
- PRIMITIVE_TYPE_LIST(V) \
- COMPOSED_TYPE_LIST(V)
-
-
class Type : public Object {
public:
#define DEFINE_TYPE_CONSTRUCTOR(type, value) \
static Type* type() { return from_bitset(k##type); }
- TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR)
+ BITSET_TYPE_LIST(DEFINE_TYPE_CONSTRUCTOR)
#undef DEFINE_TYPE_CONSTRUCTOR
static Type* Class(Handle<i::Map> map) { return from_handle(map); }
@@ -159,13 +153,18 @@
static Type* Of(Handle<i::Object> value) {
return from_bitset(LubBitset(*value));
}
- static Type* CurrentOf(Handle<i::Object> value);
- bool Is(Type* that) { return (this == that) ? true : SlowIs(that); }
+ bool Is(Type* that) { return this == that || SlowIs(that); }
bool Is(Handle<Type> that) { return this->Is(*that); }
bool Maybe(Type* that);
bool Maybe(Handle<Type> that) { return this->Maybe(*that); }
+ // State-dependent versions of Of and Is that consider subtyping between
+ // a constant and its map class.
+ static Type* OfCurrently(Handle<i::Object> value);
+ bool IsCurrently(Type* that);
+ bool IsCurrently(Handle<Type> that) { return this->IsCurrently(*that); }
+
bool IsClass() { return is_class(); }
bool IsConstant() { return is_constant(); }
Handle<i::Map> AsClass() { return as_class(); }
@@ -226,7 +225,7 @@
enum {
#define DECLARE_TYPE(type, value) k##type = (value),
- TYPE_LIST(DECLARE_TYPE)
+ BITSET_TYPE_LIST(DECLARE_TYPE)
#undef DECLARE_TYPE
kUnusedEOL = 0
};
@@ -277,29 +276,7 @@
int ExtendIntersection(
Handle<Unioned> unioned, Handle<Type> type, int current_size);
- static const char* GetComposedName(int type) {
- switch (type) {
- #define PRINT_COMPOSED_TYPE(type, value) \
- case k##type: \
- return # type;
- COMPOSED_TYPE_LIST(PRINT_COMPOSED_TYPE)
- #undef PRINT_COMPOSED_TYPE
- }
- return NULL;
- }
-
- static const char* GetPrimitiveName(int type) {
- switch (type) {
- #define PRINT_PRIMITIVE_TYPE(type, value) \
- case k##type: \
- return # type;
- PRIMITIVE_TYPE_LIST(PRINT_PRIMITIVE_TYPE)
- #undef PRINT_PRIMITIVE_TYPE
- default:
- UNREACHABLE();
- return "InvalidType";
- }
- }
+ static const char* bitset_name(int bitset);
};
diff --git a/src/v8-counters.h b/src/v8-counters.h
index 55e1e5c..54e8100 100644
--- a/src/v8-counters.h
+++ b/src/v8-counters.h
@@ -261,6 +261,9 @@
SC(soft_deopts_requested, V8.SoftDeoptsRequested) \
SC(soft_deopts_inserted, V8.SoftDeoptsInserted) \
SC(soft_deopts_executed, V8.SoftDeoptsExecuted) \
+ /* Number of write barriers in generated code. */ \
+ SC(write_barriers_dynamic, V8.WriteBarriersDynamic) \
+ SC(write_barriers_static, V8.WriteBarriersStatic) \
SC(new_space_bytes_available, V8.MemoryNewSpaceBytesAvailable) \
SC(new_space_bytes_committed, V8.MemoryNewSpaceBytesCommitted) \
SC(new_space_bytes_used, V8.MemoryNewSpaceBytesUsed) \
diff --git a/src/v8.cc b/src/v8.cc
index c56c82a..0f01818 100644
--- a/src/v8.cc
+++ b/src/v8.cc
@@ -119,25 +119,6 @@
}
-// Used by JavaScript APIs
-uint32_t V8::Random(Context* context) {
- ASSERT(context->IsNativeContext());
- ByteArray* seed = context->random_seed();
- uint32_t* state = reinterpret_cast<uint32_t*>(seed->GetDataStartAddress());
-
- // When we get here, the RNG must have been initialized,
- // see the Genesis constructor in file bootstrapper.cc.
- ASSERT_NE(0, state[0]);
- ASSERT_NE(0, state[1]);
-
- // Mix the bits. Never replaces state[i] with 0 if it is nonzero.
- state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16);
- state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16);
-
- return (state[0] << 14) + (state[1] & 0x3FFFF);
-}
-
-
void V8::AddCallCompletedCallback(CallCompletedCallback callback) {
if (call_completed_callbacks_ == NULL) { // Lazy init.
call_completed_callbacks_ = new List<CallCompletedCallback>();
diff --git a/src/v8.h b/src/v8.h
index 6f2633a..8069e8a 100644
--- a/src/v8.h
+++ b/src/v8.h
@@ -96,8 +96,6 @@
ReturnAddressLocationResolver resolver);
// Support for entry hooking JITed code.
static void SetFunctionEntryHook(FunctionEntryHook entry_hook);
- // Random number generation support. Not cryptographically safe.
- static uint32_t Random(Context* context);
static void AddCallCompletedCallback(CallCompletedCallback callback);
static void RemoveCallCompletedCallback(CallCompletedCallback callback);
diff --git a/src/version.cc b/src/version.cc
index c76c1b2..ce766ce 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -34,7 +34,7 @@
// system so their names cannot be changed without changing the scripts.
#define MAJOR_VERSION 3
#define MINOR_VERSION 23
-#define BUILD_NUMBER 10
+#define BUILD_NUMBER 11
#define PATCH_LEVEL 0
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
index 30cd314..f4864f8 100644
--- a/src/x64/builtins-x64.cc
+++ b/src/x64/builtins-x64.cc
@@ -662,7 +662,8 @@
}
-void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
+static void Generate_NotifyStubFailureHelper(MacroAssembler* masm,
+ SaveFPRegsMode save_doubles) {
// Enter an internal frame.
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -671,7 +672,7 @@
// stubs that tail call the runtime on deopts passing their parameters in
// registers.
__ Pushad();
- __ CallRuntime(Runtime::kNotifyStubFailure, 0);
+ __ CallRuntime(Runtime::kNotifyStubFailure, 0, save_doubles);
__ Popad();
// Tear down internal frame.
}
@@ -681,6 +682,16 @@
}
+void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
+ Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs);
+}
+
+
+void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) {
+ Generate_NotifyStubFailureHelper(masm, kSaveFPRegs);
+}
+
+
static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm,
Deoptimizer::BailoutType type) {
// Enter an internal frame.
diff --git a/src/x64/deoptimizer-x64.cc b/src/x64/deoptimizer-x64.cc
index 4528077..ae180ec 100644
--- a/src/x64/deoptimizer-x64.cc
+++ b/src/x64/deoptimizer-x64.cc
@@ -126,6 +126,11 @@
}
+Code* Deoptimizer::NotifyStubFailureBuiltin() {
+ return isolate_->builtins()->builtin(Builtins::kNotifyStubFailureSaveDoubles);
+}
+
+
#define __ masm()->
void Deoptimizer::EntryGenerator::Generate() {
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
index 71b5468..a62fde0 100644
--- a/src/x64/full-codegen-x64.cc
+++ b/src/x64/full-codegen-x64.cc
@@ -3271,47 +3271,6 @@
}
-void FullCodeGenerator::EmitRandomHeapNumber(CallRuntime* expr) {
- ASSERT(expr->arguments()->length() == 0);
-
- Label slow_allocate_heapnumber;
- Label heapnumber_allocated;
-
- __ AllocateHeapNumber(rbx, rcx, &slow_allocate_heapnumber);
- __ jmp(&heapnumber_allocated);
-
- __ bind(&slow_allocate_heapnumber);
- // Allocate a heap number.
- __ CallRuntime(Runtime::kNumberAlloc, 0);
- __ movq(rbx, rax);
-
- __ bind(&heapnumber_allocated);
-
- // Return a random uint32 number in rax.
- // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs.
- __ PrepareCallCFunction(1);
- __ movq(arg_reg_1,
- ContextOperand(context_register(), Context::GLOBAL_OBJECT_INDEX));
- __ movq(arg_reg_1,
- FieldOperand(arg_reg_1, GlobalObject::kNativeContextOffset));
- __ CallCFunction(ExternalReference::random_uint32_function(isolate()), 1);
-
- // Convert 32 random bits in rax to 0.(32 random bits) in a double
- // by computing:
- // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
- __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single.
- __ movd(xmm1, rcx);
- __ movd(xmm0, rax);
- __ cvtss2sd(xmm1, xmm1);
- __ xorps(xmm0, xmm1);
- __ subsd(xmm0, xmm1);
- __ movsd(FieldOperand(rbx, HeapNumber::kValueOffset), xmm0);
-
- __ movq(rax, rbx);
- context()->Plug(rax);
-}
-
-
void FullCodeGenerator::EmitSubString(CallRuntime* expr) {
// Load the arguments on the stack and call the stub.
SubStringStub stub;
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index 0c95745..cf0632e 100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -111,6 +111,38 @@
#endif
+void LCodeGen::SaveCallerDoubles() {
+ ASSERT(info()->saves_caller_doubles());
+ ASSERT(NeedsEagerFrame());
+ Comment(";;; Save clobbered callee double registers");
+ int count = 0;
+ BitVector* doubles = chunk()->allocated_double_registers();
+ BitVector::Iterator save_iterator(doubles);
+ while (!save_iterator.Done()) {
+ __ movsd(MemOperand(rsp, count * kDoubleSize),
+ XMMRegister::FromAllocationIndex(save_iterator.Current()));
+ save_iterator.Advance();
+ count++;
+ }
+}
+
+
+void LCodeGen::RestoreCallerDoubles() {
+ ASSERT(info()->saves_caller_doubles());
+ ASSERT(NeedsEagerFrame());
+ Comment(";;; Restore clobbered callee double registers");
+ BitVector* doubles = chunk()->allocated_double_registers();
+ BitVector::Iterator save_iterator(doubles);
+ int count = 0;
+ while (!save_iterator.Done()) {
+ __ movsd(XMMRegister::FromAllocationIndex(save_iterator.Current()),
+ MemOperand(rsp, count * kDoubleSize));
+ save_iterator.Advance();
+ count++;
+ }
+}
+
+
bool LCodeGen::GeneratePrologue() {
ASSERT(is_generating());
@@ -173,16 +205,7 @@
}
if (info()->saves_caller_doubles()) {
- Comment(";;; Save clobbered callee double registers");
- int count = 0;
- BitVector* doubles = chunk()->allocated_double_registers();
- BitVector::Iterator save_iterator(doubles);
- while (!save_iterator.Done()) {
- __ movsd(MemOperand(rsp, count * kDoubleSize),
- XMMRegister::FromAllocationIndex(save_iterator.Current()));
- save_iterator.Advance();
- count++;
- }
+ SaveCallerDoubles();
}
}
@@ -261,6 +284,7 @@
Comment(";;; jump table entry %d: deoptimization bailout %d.", i, id);
}
if (jump_table_[i].needs_frame) {
+ ASSERT(!info()->saves_caller_doubles());
__ Move(kScratchRegister, ExternalReference::ForDeoptEntry(entry));
if (needs_frame.is_bound()) {
__ jmp(&needs_frame);
@@ -280,6 +304,10 @@
__ call(kScratchRegister);
}
} else {
+ if (info()->saves_caller_doubles()) {
+ ASSERT(info()->IsStub());
+ RestoreCallerDoubles();
+ }
__ call(entry, RelocInfo::RUNTIME_ENTRY);
}
}
@@ -714,7 +742,10 @@
}
ASSERT(info()->IsStub() || frame_is_built_);
- if (cc == no_condition && frame_is_built_) {
+ // Go through jump table if we need to handle condition, build frame, or
+ // restore caller doubles.
+ if (cc == no_condition && frame_is_built_ &&
+ !info()->saves_caller_doubles()) {
__ call(entry, RelocInfo::RUNTIME_ENTRY);
} else {
// We often have several deopts to the same entry, reuse the last
@@ -2657,16 +2688,7 @@
__ CallRuntime(Runtime::kTraceExit, 1);
}
if (info()->saves_caller_doubles()) {
- ASSERT(NeedsEagerFrame());
- BitVector* doubles = chunk()->allocated_double_registers();
- BitVector::Iterator save_iterator(doubles);
- int count = 0;
- while (!save_iterator.Done()) {
- __ movsd(XMMRegister::FromAllocationIndex(save_iterator.Current()),
- MemOperand(rsp, count * kDoubleSize));
- save_iterator.Advance();
- count++;
- }
+ RestoreCallerDoubles();
}
int no_frame_start = -1;
if (NeedsEagerFrame()) {
@@ -3698,66 +3720,6 @@
}
-void LCodeGen::DoRandom(LRandom* instr) {
- // Assert that register size is twice the size of each seed.
- static const int kSeedSize = sizeof(uint32_t);
- STATIC_ASSERT(kPointerSize == 2 * kSeedSize);
-
- // Load native context
- Register global_object = ToRegister(instr->global_object());
- Register native_context = global_object;
- __ movq(native_context, FieldOperand(
- global_object, GlobalObject::kNativeContextOffset));
-
- // Load state (FixedArray of the native context's random seeds)
- static const int kRandomSeedOffset =
- FixedArray::kHeaderSize + Context::RANDOM_SEED_INDEX * kPointerSize;
- Register state = native_context;
- __ movq(state, FieldOperand(native_context, kRandomSeedOffset));
-
- // Load state[0].
- Register state0 = ToRegister(instr->scratch());
- __ movl(state0, FieldOperand(state, ByteArray::kHeaderSize));
- // Load state[1].
- Register state1 = ToRegister(instr->scratch2());
- __ movl(state1, FieldOperand(state, ByteArray::kHeaderSize + kSeedSize));
-
- // state[0] = 18273 * (state[0] & 0xFFFF) + (state[0] >> 16)
- Register scratch3 = ToRegister(instr->scratch3());
- __ movzxwl(scratch3, state0);
- __ imull(scratch3, scratch3, Immediate(18273));
- __ shrl(state0, Immediate(16));
- __ addl(state0, scratch3);
- // Save state[0].
- __ movl(FieldOperand(state, ByteArray::kHeaderSize), state0);
-
- // state[1] = 36969 * (state[1] & 0xFFFF) + (state[1] >> 16)
- __ movzxwl(scratch3, state1);
- __ imull(scratch3, scratch3, Immediate(36969));
- __ shrl(state1, Immediate(16));
- __ addl(state1, scratch3);
- // Save state[1].
- __ movl(FieldOperand(state, ByteArray::kHeaderSize + kSeedSize), state1);
-
- // Random bit pattern = (state[0] << 14) + (state[1] & 0x3FFFF)
- Register random = state0;
- __ shll(random, Immediate(14));
- __ andl(state1, Immediate(0x3FFFF));
- __ addl(random, state1);
-
- // Convert 32 random bits in rax to 0.(32 random bits) in a double
- // by computing:
- // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
- XMMRegister result = ToDoubleRegister(instr->result());
- XMMRegister scratch4 = double_scratch0();
- __ movq(scratch3, V8_INT64_C(0x4130000000000000)); // 1.0 x 2^20 as double
- __ movq(scratch4, scratch3);
- __ movd(result, random);
- __ xorps(result, scratch4);
- __ subsd(result, scratch4);
-}
-
-
void LCodeGen::DoMathExp(LMathExp* instr) {
XMMRegister input = ToDoubleRegister(instr->value());
XMMRegister result = ToDoubleRegister(instr->result());
diff --git a/src/x64/lithium-codegen-x64.h b/src/x64/lithium-codegen-x64.h
index 51cfe08..53d2646 100644
--- a/src/x64/lithium-codegen-x64.h
+++ b/src/x64/lithium-codegen-x64.h
@@ -153,6 +153,10 @@
void AddDeferredCode(LDeferredCode* code) { deferred_.Add(code, zone()); }
+
+ void SaveCallerDoubles();
+ void RestoreCallerDoubles();
+
// Code generation passes. Returns true if code generation should
// continue.
bool GeneratePrologue();
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
index 2a73472..fa1bdaa 100644
--- a/src/x64/lithium-x64.cc
+++ b/src/x64/lithium-x64.cc
@@ -1601,19 +1601,6 @@
}
-LInstruction* LChunkBuilder::DoRandom(HRandom* instr) {
- ASSERT(instr->representation().IsDouble());
- ASSERT(instr->global_object()->representation().IsTagged());
- LOperand* global_object = UseTempRegister(instr->global_object());
- LOperand* scratch = TempRegister();
- LOperand* scratch2 = TempRegister();
- LOperand* scratch3 = TempRegister();
- LRandom* result = new(zone()) LRandom(
- global_object, scratch, scratch2, scratch3);
- return DefineFixedDouble(result, xmm1);
-}
-
-
LInstruction* LChunkBuilder::DoCompareGeneric(HCompareGeneric* instr) {
ASSERT(instr->left()->representation().IsTagged());
ASSERT(instr->right()->representation().IsTagged());
diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h
index a475d8c..ca7831c 100644
--- a/src/x64/lithium-x64.h
+++ b/src/x64/lithium-x64.h
@@ -153,7 +153,6 @@
V(Parameter) \
V(Power) \
V(PushArgument) \
- V(Random) \
V(RegExpLiteral) \
V(Return) \
V(SeqStringGetChar) \
@@ -1424,28 +1423,6 @@
};
-class LRandom V8_FINAL : public LTemplateInstruction<1, 1, 3> {
- public:
- LRandom(LOperand* global_object,
- LOperand* scratch,
- LOperand* scratch2,
- LOperand* scratch3) {
- inputs_[0] = global_object;
- temps_[0] = scratch;
- temps_[1] = scratch2;
- temps_[2] = scratch3;
- }
-
- LOperand* global_object() { return inputs_[0]; }
- LOperand* scratch() const { return temps_[0]; }
- LOperand* scratch2() const { return temps_[1]; }
- LOperand* scratch3() const { return temps_[2]; }
-
- DECLARE_CONCRETE_INSTRUCTION(Random, "random")
- DECLARE_HYDROGEN_ACCESSOR(Random)
-};
-
-
class LArithmeticD V8_FINAL : public LTemplateInstruction<1, 2, 0> {
public:
LArithmeticD(Token::Value op, LOperand* left, LOperand* right)
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index 25f4bd3..49629c7 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -405,6 +405,10 @@
bind(&ok);
}
+ // Count number of write barriers in generated code.
+ isolate()->counters()->write_barriers_static()->Increment();
+ IncrementCounter(isolate()->counters()->write_barriers_dynamic(), 1);
+
// First, check if a write barrier is even needed. The tests below
// catch stores of smis and stores into the young generation.
Label done;
diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h
index f7bf1ca..06b2f80 100644
--- a/src/x64/macro-assembler-x64.h
+++ b/src/x64/macro-assembler-x64.h
@@ -1266,8 +1266,10 @@
}
// Convenience function: Same as above, but takes the fid instead.
- void CallRuntime(Runtime::FunctionId id, int num_arguments) {
- CallRuntime(Runtime::FunctionForId(id), num_arguments);
+ void CallRuntime(Runtime::FunctionId id,
+ int num_arguments,
+ SaveFPRegsMode save_doubles = kDontSaveFPRegs) {
+ CallRuntime(Runtime::FunctionForId(id), num_arguments, save_doubles);
}
// Convenience function: call an external reference.
diff --git a/src/x64/simulator-x64.cc b/src/x64/simulator-x64.cc
index 209aa2d..448b025 100644
--- a/src/x64/simulator-x64.cc
+++ b/src/x64/simulator-x64.cc
@@ -24,4 +24,3 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc
index 963bc12..57c6a35 100644
--- a/src/x64/stub-cache-x64.cc
+++ b/src/x64/stub-cache-x64.cc
@@ -720,9 +720,10 @@
Label miss_cleanup;
Label* miss = can_do_fast_api_call ? &miss_cleanup : miss_label;
Register holder =
- stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
- scratch1, scratch2, scratch3,
- name, depth1, miss);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(object, masm->isolate()), receiver,
+ interceptor_holder, scratch1, scratch2, scratch3,
+ name, depth1, miss);
// Invoke an interceptor and if it provides a value,
// branch to |regular_invoke|.
@@ -736,10 +737,10 @@
// Check that the maps from interceptor's holder to constant function's
// holder haven't changed and thus we can use cached constant function.
if (*interceptor_holder != lookup->holder()) {
- stub_compiler_->CheckPrototypes(interceptor_holder, receiver,
- Handle<JSObject>(lookup->holder()),
- scratch1, scratch2, scratch3,
- name, depth2, miss);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(interceptor_holder, masm->isolate()), receiver,
+ handle(lookup->holder()), scratch1, scratch2, scratch3,
+ name, depth2, miss);
} else {
// CheckPrototypes has a side effect of fetching a 'holder'
// for API (object which is instanceof for the signature). It's
@@ -785,9 +786,9 @@
Handle<JSObject> interceptor_holder,
Label* miss_label) {
Register holder =
- stub_compiler_->CheckPrototypes(object, receiver, interceptor_holder,
- scratch1, scratch2, scratch3,
- name, miss_label);
+ stub_compiler_->CheckPrototypes(
+ IC::CurrentTypeOf(object, masm->isolate()), receiver,
+ interceptor_holder, scratch1, scratch2, scratch3, name, miss_label);
FrameScope scope(masm, StackFrame::INTERNAL);
// Save the name_ register across the call.
@@ -1122,26 +1123,6 @@
}
-void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
- Handle<JSObject> object,
- Handle<JSObject> holder,
- Handle<Name> name,
- Register scratch,
- Label* miss) {
- Handle<JSObject> current = object;
- while (!current.is_identical_to(holder)) {
- if (current->IsJSGlobalObject()) {
- GenerateCheckPropertyCell(masm,
- Handle<JSGlobalObject>::cast(current),
- name,
- scratch,
- miss);
- }
- current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
- }
-}
-
-
void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
__ jmp(code, RelocInfo::CODE_TARGET);
}
@@ -1151,7 +1132,7 @@
#define __ ACCESS_MASM((masm()))
-Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
+Register StubCompiler::CheckPrototypes(Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Register holder_reg,
@@ -1161,11 +1142,11 @@
int save_at_depth,
Label* miss,
PrototypeCheckType check) {
+ Handle<Map> receiver_map(IC::TypeToMap(*type, isolate()));
// Make sure that the type feedback oracle harvests the receiver map.
// TODO(svenpanne) Remove this hack when all ICs are reworked.
- __ Move(scratch1, Handle<Map>(object->map()));
+ __ Move(scratch1, receiver_map);
- Handle<JSObject> first = object;
// Make sure there's no overlap between holder and object registers.
ASSERT(!scratch1.is(object_reg) && !scratch1.is(holder_reg));
ASSERT(!scratch2.is(object_reg) && !scratch2.is(holder_reg)
@@ -1186,25 +1167,31 @@
__ movq(args.GetArgumentOperand(kHolderIndex), object_reg);
}
- // Check the maps in the prototype chain.
- // Traverse the prototype chain from the object and do map checks.
- Handle<JSObject> current = object;
- while (!current.is_identical_to(holder)) {
+ Handle<JSObject> current = Handle<JSObject>::null();
+ if (type->IsConstant()) current = Handle<JSObject>::cast(type->AsConstant());
+ Handle<JSObject> prototype = Handle<JSObject>::null();
+ Handle<Map> current_map = receiver_map;
+ Handle<Map> holder_map(holder->map());
+ // Traverse the prototype chain and check the maps in the prototype chain for
+ // fast and global objects or do negative lookup for normal objects.
+ while (!current_map.is_identical_to(holder_map)) {
++depth;
// Only global objects and objects that do not require access
// checks are allowed in stubs.
- ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
+ ASSERT(current_map->IsJSGlobalProxyMap() ||
+ !current_map->is_access_check_needed());
- Handle<JSObject> prototype(JSObject::cast(current->GetPrototype()));
- if (!current->HasFastProperties() &&
- !current->IsJSGlobalObject() &&
- !current->IsJSGlobalProxy()) {
+ prototype = handle(JSObject::cast(current_map->prototype()));
+ if (current_map->is_dictionary_map() &&
+ !current_map->IsJSGlobalObjectMap() &&
+ !current_map->IsJSGlobalProxyMap()) {
if (!name->IsUniqueName()) {
ASSERT(name->IsString());
name = factory()->InternalizeString(Handle<String>::cast(name));
}
- ASSERT(current->property_dictionary()->FindEntry(*name) ==
+ ASSERT(current.is_null() ||
+ current->property_dictionary()->FindEntry(*name) ==
NameDictionary::kNotFound);
GenerateDictionaryNegativeLookup(masm(), miss, reg, name,
@@ -1215,20 +1202,23 @@
__ movq(reg, FieldOperand(scratch1, Map::kPrototypeOffset));
} else {
bool in_new_space = heap()->InNewSpace(*prototype);
- Handle<Map> current_map(current->map());
if (in_new_space) {
// Save the map in scratch1 for later.
__ movq(scratch1, FieldOperand(reg, HeapObject::kMapOffset));
}
- if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) {
+ if (depth != 1 || check == CHECK_ALL_MAPS) {
__ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK);
}
// Check access rights to the global object. This has to happen after
// the map check so that we know that the object is actually a global
// object.
- if (current->IsJSGlobalProxy()) {
+ if (current_map->IsJSGlobalProxyMap()) {
__ CheckAccessGlobalProxy(reg, scratch2, miss);
+ } else if (current_map->IsJSGlobalObjectMap()) {
+ GenerateCheckPropertyCell(
+ masm(), Handle<JSGlobalObject>::cast(current), name,
+ scratch2, miss);
}
reg = holder_reg; // From now on the object will be in holder_reg.
@@ -1248,28 +1238,24 @@
// Go to the next object in the prototype chain.
current = prototype;
+ current_map = handle(current->map());
}
- ASSERT(current.is_identical_to(holder));
// Log the check depth.
LOG(isolate(), IntEvent("check-maps-depth", depth + 1));
- if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) {
+ if (depth != 0 || check == CHECK_ALL_MAPS) {
// Check the holder map.
- __ CheckMap(reg, Handle<Map>(holder->map()), miss, DONT_DO_SMI_CHECK);
+ __ CheckMap(reg, current_map, miss, DONT_DO_SMI_CHECK);
}
// Perform security check for access to the global object.
- ASSERT(current->IsJSGlobalProxy() || !current->IsAccessCheckNeeded());
- if (current->IsJSGlobalProxy()) {
+ ASSERT(current_map->IsJSGlobalProxyMap() ||
+ !current_map->is_access_check_needed());
+ if (current_map->IsJSGlobalProxyMap()) {
__ CheckAccessGlobalProxy(reg, scratch1, miss);
}
- // If we've skipped any global objects, it's not enough to verify that
- // their maps haven't changed. We also need to check that the property
- // cell for the property is still empty.
- GenerateCheckPropertyCells(masm(), object, holder, name, scratch1, miss);
-
// Return the register containing the holder.
return reg;
}
@@ -1298,14 +1284,14 @@
Register LoadStubCompiler::CallbackHandlerFrontend(
- Handle<Object> object,
+ Handle<Type> type,
Register object_reg,
Handle<JSObject> holder,
Handle<Name> name,
Handle<Object> callback) {
Label miss;
- Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss);
+ Register reg = HandlerFrontendHeader(type, object_reg, holder, name, &miss);
if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
ASSERT(!reg.is(scratch2()));
@@ -1575,7 +1561,8 @@
// Check that the maps haven't changed.
__ JumpIfSmi(rdx, miss);
- CheckPrototypes(object, rdx, holder, rbx, rax, rdi, name, miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, miss);
}
@@ -1641,8 +1628,8 @@
__ JumpIfSmi(rdx, &miss);
// Do the right check and compute the holder register.
- Register reg = CheckPrototypes(object, rdx, holder, rbx, rax, rdi,
- name, &miss);
+ Register reg = CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx,
+ holder, rbx, rax, rdi, name, &miss);
GenerateFastPropertyLoad(masm(), rdi, reg, index.is_inobject(holder),
index.translate(holder), Representation::Tagged());
@@ -1694,8 +1681,8 @@
// Check that the receiver isn't a smi.
__ JumpIfSmi(rdx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -1753,8 +1740,8 @@
// Check that the receiver isn't a smi.
__ JumpIfSmi(rdx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, &miss);
if (argc == 0) {
// Noop, return the length.
@@ -2008,8 +1995,8 @@
// Check that the receiver isn't a smi.
__ JumpIfSmi(rdx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, &miss);
// Get the elements array of the object.
__ movq(rbx, FieldOperand(rdx, JSArray::kElementsOffset));
@@ -2100,8 +2087,9 @@
rax,
&miss);
ASSERT(!object.is_identical_to(holder));
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
rax, holder, rbx, rdx, rdi, name, &miss);
Register receiver = rbx;
@@ -2182,8 +2170,9 @@
rax,
&miss);
ASSERT(!object.is_identical_to(holder));
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
rax, holder, rbx, rdx, rdi, name, &miss);
Register receiver = rax;
@@ -2254,8 +2243,8 @@
if (cell.is_null()) {
__ movq(rdx, args.GetReceiverOperand());
__ JumpIfSmi(rdx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2332,8 +2321,8 @@
STATIC_ASSERT(kSmiTag == 0);
__ JumpIfSmi(rdx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2455,8 +2444,8 @@
if (cell.is_null()) {
__ movq(rdx, args.GetReceiverOperand());
__ JumpIfSmi(rdx, &miss);
- CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
- name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, &miss);
} else {
ASSERT(cell->value() == *function);
GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
@@ -2569,8 +2558,8 @@
__ subq(rsp, Immediate(kFastApiCallArguments * kPointerSize));
// Check that the maps haven't changed and find a Holder as a side effect.
- CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
- name, depth, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, depth, &miss);
// Move the return address on top of the stack.
__ movq(rax,
@@ -2635,8 +2624,8 @@
__ IncrementCounter(counters->call_const(), 1);
// Check that the maps haven't changed.
- CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax,
- rdi, name, &miss);
+ CheckPrototypes(IC::CurrentTypeOf(object, isolate()), rdx, holder,
+ rbx, rax, rdi, name, &miss);
// Patch the receiver on the stack with the global proxy if
// necessary.
@@ -2646,30 +2635,32 @@
}
break;
- case STRING_CHECK:
+ case STRING_CHECK: {
// Check that the object is a string.
__ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, rax);
__ j(above_equal, &miss);
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::STRING_FUNCTION_INDEX, rax, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
rax, holder, rbx, rdx, rdi, name, &miss);
break;
-
- case SYMBOL_CHECK:
+ }
+ case SYMBOL_CHECK: {
// Check that the object is a symbol.
__ CmpObjectType(rdx, SYMBOL_TYPE, rax);
__ j(not_equal, &miss);
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::SYMBOL_FUNCTION_INDEX, rax, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
rax, holder, rbx, rdx, rdi, name, &miss);
break;
-
+ }
case NUMBER_CHECK: {
Label fast;
// Check that the object is a smi or a heap number.
@@ -2680,8 +2671,9 @@
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::NUMBER_FUNCTION_INDEX, rax, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
rax, holder, rbx, rdx, rdi, name, &miss);
break;
}
@@ -2690,8 +2682,9 @@
// Check that the maps starting from the prototype haven't changed.
GenerateDirectLoadGlobalFunctionPrototype(
masm(), Context::BOOLEAN_FUNCTION_INDEX, rax, &miss);
+ Handle<Object> prototype(object->GetPrototype(isolate()), isolate());
CheckPrototypes(
- Handle<JSObject>(JSObject::cast(object->GetPrototype(isolate()))),
+ IC::CurrentTypeOf(prototype, isolate()),
rax, holder, rbx, rdx, rdi, name, &miss);
break;
}
@@ -2869,7 +2862,8 @@
Handle<JSObject> holder,
Handle<Name> name,
Handle<ExecutableAccessorInfo> callback) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
__ PopReturnAddressTo(scratch1());
__ push(receiver());
@@ -2893,7 +2887,8 @@
Handle<JSObject> holder,
Handle<Name> name,
const CallOptimization& call_optimization) {
- HandlerFrontend(object, receiver(), holder, name);
+ HandlerFrontend(IC::CurrentTypeOf(object, isolate()),
+ receiver(), holder, name);
Register values[] = { value() };
GenerateFastApiCall(
@@ -3007,12 +3002,10 @@
}
-Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
- Handle<Object> object,
- Handle<JSObject> last,
- Handle<Name> name,
- Handle<JSGlobalObject> global) {
- NonexistentHandlerFrontend(object, last, name, global);
+Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<Type> type,
+ Handle<JSObject> last,
+ Handle<Name> name) {
+ NonexistentHandlerFrontend(type, last, name);
// Return undefined if maps of the full prototype chain are still the
// same and no global property with this name contains a value.
@@ -3108,7 +3101,7 @@
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
- Handle<Object> object,
+ Handle<Type> type,
Handle<GlobalObject> global,
Handle<PropertyCell> cell,
Handle<Name> name,
@@ -3117,7 +3110,7 @@
// TODO(verwaest): Directly store to rax. Currently we cannot do this, since
// rax is used as receiver(), which we would otherwise clobber before a
// potential miss.
- HandlerFrontendHeader(object, receiver(), global, name, &miss);
+ HandlerFrontendHeader(type, receiver(), global, name, &miss);
// Get the value from the cell.
__ Move(rbx, cell);
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
index 428245d..4db0d83 100644
--- a/test/cctest/cctest.h
+++ b/test/cctest/cctest.h
@@ -255,7 +255,7 @@
virtual ~LocalContext() {
v8::HandleScope scope(isolate_);
v8::Local<v8::Context>::New(isolate_, context_)->Exit();
- context_.Dispose();
+ context_.Reset();
}
v8::Context* operator->() {
@@ -294,7 +294,7 @@
static inline v8::Local<v8::String> v8_str(const char* x) {
- return v8::String::New(x);
+ return v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), x);
}
@@ -305,7 +305,8 @@
// Helper function that compiles and runs the source.
static inline v8::Local<v8::Value> CompileRun(const char* source) {
- return v8::Script::Compile(v8::String::New(source))->Run();
+ return v8::Script::Compile(
+ v8::String::NewFromUtf8(v8::Isolate::GetCurrent(), source))->Run();
}
@@ -314,10 +315,12 @@
const char* origin_url,
int line_number,
int column_number) {
- v8::ScriptOrigin origin(v8::String::New(origin_url),
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, origin_url),
v8::Integer::New(line_number),
v8::Integer::New(column_number));
- return v8::Script::Compile(v8::String::New(source), &origin)->Run();
+ return v8::Script::Compile(v8::String::NewFromUtf8(isolate, source), &origin)
+ ->Run();
}
diff --git a/test/cctest/test-accessors.cc b/test/cctest/test-accessors.cc
index 4920ac2..0dbac3f 100644
--- a/test/cctest/test-accessors.cc
+++ b/test/cctest/test-accessors.cc
@@ -277,8 +277,8 @@
const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
for (int i = 0; i < C; i++)
- v8::String::New("foo");
- info.GetReturnValue().Set(v8::String::New("foo"));
+ v8::String::NewFromUtf8(info.GetIsolate(), "foo");
+ info.GetReturnValue().Set(v8::String::NewFromUtf8(info.GetIsolate(), "foo"));
}
@@ -289,7 +289,8 @@
obj->SetAccessor(v8_str("one"), HandleAllocatingGetter<1>);
obj->SetAccessor(v8_str("many"), HandleAllocatingGetter<1024>);
v8::Handle<v8::Object> inst = obj->NewInstance();
- context->Global()->Set(v8::String::New("obj"), inst);
+ context->Global()->Set(v8::String::NewFromUtf8(context->GetIsolate(), "obj"),
+ inst);
i::Isolate* isolate = CcTest::i_isolate();
int count_before = i::HandleScope::NumberOfHandles(isolate);
{
@@ -309,15 +310,18 @@
const v8::PropertyCallbackInfo<v8::Value>& info) {
CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder());
- CHECK(info.Data()->Equals(v8::String::New("data")));
+ CHECK(
+ info.Data()->Equals(v8::String::NewFromUtf8(CcTest::isolate(), "data")));
ApiTestFuzzer::Fuzz();
CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder());
- CHECK(info.Data()->Equals(v8::String::New("data")));
+ CHECK(
+ info.Data()->Equals(v8::String::NewFromUtf8(CcTest::isolate(), "data")));
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder());
- CHECK(info.Data()->Equals(v8::String::New("data")));
+ CHECK(
+ info.Data()->Equals(v8::String::NewFromUtf8(CcTest::isolate(), "data")));
info.GetReturnValue().Set(17);
}
@@ -329,10 +333,12 @@
obj->SetAccessor(v8_str("xxx"),
CheckAccessorArgsCorrect,
NULL,
- v8::String::New("data"));
+ v8::String::NewFromUtf8(context->GetIsolate(), "data"));
v8::Handle<v8::Object> inst = obj->NewInstance();
- context->Global()->Set(v8::String::New("obj"), inst);
- Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
+ context->Global()->Set(v8::String::NewFromUtf8(context->GetIsolate(), "obj"),
+ inst);
+ Local<Script> scr = v8::Script::Compile(
+ v8::String::NewFromUtf8(context->GetIsolate(), "obj.xxx"));
for (int i = 0; i < 10; i++) {
Local<Value> result = scr->Run();
CHECK(!result.IsEmpty());
@@ -354,10 +360,12 @@
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
- obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
+ obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL,
+ v8::String::NewFromUtf8(isolate, "data"));
v8::Handle<v8::Object> inst = obj->NewInstance();
- context->Global()->Set(v8::String::New("obj"), inst);
- Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
+ context->Global()->Set(v8::String::NewFromUtf8(isolate, "obj"), inst);
+ Local<Script> scr =
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, "obj.xxx"));
for (int i = 0; i < 10; i++) {
Local<Value> result = scr->Run();
CHECK(result == v8::Undefined(isolate));
@@ -372,11 +380,13 @@
v8::HandleScope scope(isolate);
{
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
- obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
+ obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL,
+ v8::String::NewFromUtf8(isolate, "data"));
LocalContext context;
v8::Handle<v8::Object> inst = obj->NewInstance();
- context->Global()->Set(v8::String::New("obj"), inst);
- Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
+ context->Global()->Set(v8::String::NewFromUtf8(isolate, "obj"), inst);
+ Local<Script> scr =
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, "obj.xxx"));
for (int i = 0; i < 2; i++) {
Local<Value> result = scr->Run();
CHECK(result == v8::Undefined(isolate));
@@ -387,11 +397,12 @@
obj->SetAccessor(v8_str("xxx"),
CheckAccessorArgsCorrect,
NULL,
- v8::String::New("data"));
+ v8::String::NewFromUtf8(isolate, "data"));
LocalContext context;
v8::Handle<v8::Object> inst = obj->NewInstance();
- context->Global()->Set(v8::String::New("obj"), inst);
- Local<Script> scr = v8::Script::Compile(v8::String::New("obj.xxx"));
+ context->Global()->Set(v8::String::NewFromUtf8(isolate, "obj"), inst);
+ Local<Script> scr =
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, "obj.xxx"));
for (int i = 0; i < 10; i++) {
Local<Value> result = scr->Run();
CHECK(!result.IsEmpty());
@@ -436,7 +447,8 @@
"}; result"))->Run();
CHECK_EQ(v8_str("ggggg"), result);
- result = Script::Compile(String::New(
+ result = Script::Compile(String::NewFromUtf8(
+ env->GetIsolate(),
"var result = '';"
"for (var i = 0; i < 5; i++) {"
" try { obj.x = i; } catch (e) { result += e; }"
@@ -458,7 +470,8 @@
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
obj->SetAccessor(v8_str("xxx"), AllocGetter);
env->Global()->Set(v8_str("obj"), obj->NewInstance());
- Script::Compile(String::New(
+ Script::Compile(String::NewFromUtf8(
+ env->GetIsolate(),
"var last = [];"
"for (var i = 0; i < 2048; i++) {"
" var result = obj.xxx;"
@@ -491,7 +504,8 @@
i::StringStream::ClearMentionedObjectCache(isolate);
obj->SetAccessor(v8_str("xxx"), StackCheck);
env->Global()->Set(v8_str("obj"), obj->NewInstance());
- Script::Compile(String::New(
+ Script::Compile(String::NewFromUtf8(
+ env->GetIsolate(),
"function foo() {"
" return obj.xxx;"
"}"
@@ -518,7 +532,8 @@
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
obj->SetAccessor(v8_str("xxx"), AllocateHandles);
env->Global()->Set(v8_str("obj"), obj->NewInstance());
- v8::Handle<v8::Value> result = Script::Compile(String::New(
+ v8::Handle<v8::Value> result = Script::Compile(String::NewFromUtf8(
+ env->GetIsolate(),
"var result;"
"for (var i = 0; i < 4; i++)"
" result = obj.xxx;"
diff --git a/test/cctest/test-alloc.cc b/test/cctest/test-alloc.cc
index 7a5979a..efbb8d6 100644
--- a/test/cctest/test-alloc.cc
+++ b/test/cctest/test-alloc.cc
@@ -148,10 +148,11 @@
map->AppendDescriptor(&d, witness);
// Add the Foo constructor the global object.
- env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function));
+ env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "Foo"),
+ v8::Utils::ToLocal(function));
// Call the accessor through JavaScript.
- v8::Handle<v8::Value> result =
- v8::Script::Compile(v8::String::New("(new Foo).get"))->Run();
+ v8::Handle<v8::Value> result = v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(), "(new Foo).get"))->Run();
CHECK_EQ(42, result->Int32Value());
env->Exit();
}
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index 761b402..0db63c1 100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -88,7 +88,8 @@
void RunWithProfiler(void (*test)()) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::Local<v8::String> profile_name = v8::String::New("my_profile1");
+ v8::Local<v8::String> profile_name =
+ v8::String::NewFromUtf8(env->GetIsolate(), "my_profile1");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->StartCpuProfiling(profile_name);
@@ -202,7 +203,7 @@
CHECK(undef->IsUndefined());
const char* c_source = "1 + 2 + 3";
- Local<String> source = String::New(c_source);
+ Local<String> source = String::NewFromUtf8(CcTest::isolate(), c_source);
Local<Script> script = Script::Compile(source);
CHECK_EQ(6, script->Run()->Int32Value());
@@ -214,13 +215,13 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<Context> env = Context::New(CcTest::isolate());
- CHECK(!env->InContext());
+ CHECK(!env->GetIsolate()->InContext());
CHECK(env->GetIsolate() == CcTest::isolate());
env->Enter();
- CHECK(env->InContext());
+ CHECK(env->GetIsolate()->InContext());
CHECK(env->GetIsolate() == CcTest::isolate());
env->Exit();
- CHECK(!env->InContext());
+ CHECK(!env->GetIsolate()->InContext());
CHECK(env->GetIsolate() == CcTest::isolate());
}
@@ -434,7 +435,7 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
const char* c_source = "1 + 2 + 3";
- Local<String> source = String::New(c_source);
+ Local<String> source = String::NewFromUtf8(env->GetIsolate(), c_source);
Local<Script> script = Script::Compile(source);
CHECK_EQ(6, script->Run()->Int32Value());
}
@@ -562,7 +563,8 @@
{
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- Local<String> source = String::New(two_byte_source);
+ Local<String> source =
+ String::NewFromTwoByte(env->GetIsolate(), two_byte_source);
// Trigger GCs so that the newly allocated string moves to old gen.
CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now
CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now
@@ -622,7 +624,8 @@
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
uint16_t* two_byte_string = AsciiToTwoByteString("s1");
- Local<String> small_string = String::New(two_byte_string);
+ Local<String> small_string =
+ String::NewFromTwoByte(env->GetIsolate(), two_byte_string);
i::DeleteArray(two_byte_string);
// We should refuse to externalize newly created small string.
@@ -634,7 +637,7 @@
CHECK(small_string->CanMakeExternal());
two_byte_string = AsciiToTwoByteString("small string 2");
- small_string = String::New(two_byte_string);
+ small_string = String::NewFromTwoByte(env->GetIsolate(), two_byte_string);
i::DeleteArray(two_byte_string);
// We should refuse externalizing newly created small string.
@@ -651,7 +654,8 @@
buf[buf_size - 1] = '\0';
two_byte_string = AsciiToTwoByteString(buf);
- Local<String> large_string = String::New(two_byte_string);
+ Local<String> large_string =
+ String::NewFromTwoByte(env->GetIsolate(), two_byte_string);
i::DeleteArray(buf);
i::DeleteArray(two_byte_string);
// Large strings should be immediately accepted.
@@ -667,7 +671,7 @@
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
CcTest::heap()->CollectGarbage(i::NEW_SPACE);
- Local<String> small_string = String::New("s1");
+ Local<String> small_string = String::NewFromUtf8(env->GetIsolate(), "s1");
// We should refuse to externalize newly created small string.
CHECK(!small_string->CanMakeExternal());
// Trigger GCs so that the newly allocated string moves to old gen.
@@ -676,7 +680,7 @@
// Old space strings should be accepted.
CHECK(small_string->CanMakeExternal());
- small_string = String::New("small string 2");
+ small_string = String::NewFromUtf8(env->GetIsolate(), "small string 2");
// We should refuse externalizing newly created small string.
CHECK(!small_string->CanMakeExternal());
for (int i = 0; i < 100; i++) {
@@ -689,7 +693,7 @@
char* buf = i::NewArray<char>(buf_size);
memset(buf, 'a', buf_size);
buf[buf_size - 1] = '\0';
- Local<String> large_string = String::New(buf);
+ Local<String> large_string = String::NewFromUtf8(env->GetIsolate(), buf);
i::DeleteArray(buf);
// Large strings should be immediately accepted.
CHECK(large_string->CanMakeExternal());
@@ -899,7 +903,8 @@
Local<String> left = v8_str(one_byte_string_1);
uint16_t* two_byte_source = AsciiToTwoByteString(two_byte_string_1);
- Local<String> right = String::New(two_byte_source);
+ Local<String> right =
+ String::NewFromTwoByte(env->GetIsolate(), two_byte_source);
i::DeleteArray(two_byte_source);
Local<String> source = String::Concat(left, right);
@@ -913,7 +918,7 @@
source = String::Concat(source, right);
two_byte_source = AsciiToTwoByteString(two_byte_string_2);
- right = String::New(two_byte_source);
+ right = String::NewFromTwoByte(env->GetIsolate(), two_byte_source);
i::DeleteArray(two_byte_source);
source = String::Concat(source, right);
@@ -2522,7 +2527,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Object> global = env->Global();
- global->Set(0, v8::String::New("value"));
+ global->Set(0, v8::String::NewFromUtf8(CcTest::isolate(), "value"));
CHECK(global->HasRealIndexedProperty(0));
}
@@ -2614,8 +2619,11 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- CheckEmbedderData(&env, 3, v8::String::New("The quick brown fox jumps"));
- CheckEmbedderData(&env, 2, v8::String::New("over the lazy dog."));
+ CheckEmbedderData(
+ &env, 3,
+ v8::String::NewFromUtf8(env->GetIsolate(), "The quick brown fox jumps"));
+ CheckEmbedderData(&env, 2, v8::String::NewFromUtf8(env->GetIsolate(),
+ "over the lazy dog."));
CheckEmbedderData(&env, 1, v8::Number::New(1.2345));
CheckEmbedderData(&env, 0, v8::Boolean::New(true));
}
@@ -2692,7 +2700,7 @@
CHECK(!sym1->StrictEquals(sym2));
CHECK(!sym2->StrictEquals(sym1));
- CHECK(sym2->Name()->Equals(v8::String::New("my-symbol")));
+ CHECK(sym2->Name()->Equals(v8::String::NewFromUtf8(isolate, "my-symbol")));
v8::Local<v8::Value> sym_val = sym2;
CHECK(sym_val->IsSymbol());
@@ -2723,7 +2731,8 @@
CHECK_EQ(0, obj->GetOwnPropertyNames()->Length());
int num_props = obj->GetPropertyNames()->Length();
- CHECK(obj->Set(v8::String::New("bla"), v8::Integer::New(20)));
+ CHECK(
+ obj->Set(v8::String::NewFromUtf8(isolate, "bla"), v8::Integer::New(20)));
CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length());
@@ -2765,7 +2774,7 @@
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
- CHECK(priv2->Name()->Equals(v8::String::New("my-private")));
+ CHECK(priv2->Name()->Equals(v8::String::NewFromUtf8(isolate, "my-private")));
// Make sure delete of a non-existent private symbol property works.
CHECK(obj->DeletePrivate(priv1));
@@ -2780,7 +2789,8 @@
CHECK_EQ(0, obj->GetOwnPropertyNames()->Length());
int num_props = obj->GetPropertyNames()->Length();
- CHECK(obj->Set(v8::String::New("bla"), v8::Integer::New(20)));
+ CHECK(
+ obj->Set(v8::String::NewFromUtf8(isolate, "bla"), v8::Integer::New(20)));
CHECK_EQ(1, obj->GetOwnPropertyNames()->Length());
CHECK_EQ(num_props + 1, obj->GetPropertyNames()->Length());
@@ -3224,8 +3234,7 @@
v8::HandleScope scope(isolate);
CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3);
}
- global.Dispose();
- global.Clear();
+ global.Reset();
{
v8::HandleScope scope(isolate);
global.Reset(isolate, v8_str("str"));
@@ -3234,7 +3243,7 @@
v8::HandleScope scope(isolate);
CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3);
}
- global.Dispose();
+ global.Reset();
}
@@ -3261,7 +3270,7 @@
v8::HandleScope scope(isolate);
CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 6);
}
- global.Dispose();
+ global.Reset();
CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1);
}
@@ -3290,28 +3299,6 @@
}
-THREADED_TEST(ClearAndLeakGlobal) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::internal::GlobalHandles* global_handles = NULL;
- int initial_handle_count = 0;
- v8::Persistent<String> global;
- {
- v8::HandleScope scope(isolate);
- Local<String> str = v8_str("str");
- global_handles =
- reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
- initial_handle_count = global_handles->global_handles_count();
- global.Reset(isolate, str);
- }
- CHECK_EQ(global_handles->global_handles_count(), initial_handle_count + 1);
- String* str = global.ClearAndLeak();
- CHECK(global.IsEmpty());
- CHECK_EQ(global_handles->global_handles_count(), initial_handle_count + 1);
- global_handles->Destroy(reinterpret_cast<i::Object**>(str));
- CHECK_EQ(global_handles->global_handles_count(), initial_handle_count);
-}
-
-
THREADED_TEST(GlobalHandleUpcast) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
@@ -3321,7 +3308,7 @@
v8::Persistent<Value>::Cast(global_string);
CHECK(v8::Local<v8::Value>::New(isolate, global_value)->IsString());
CHECK(global_string == v8::Persistent<String>::Cast(global_value));
- global_string.Dispose();
+ global_string.Reset();
}
@@ -3358,8 +3345,8 @@
CHECK_EQ(local1 == anotherLocal1, true);
CHECK_EQ(local1 != anotherLocal1, false);
}
- global1.Dispose();
- global2.Dispose();
+ global1.Reset();
+ global2.Reset();
}
@@ -3389,7 +3376,7 @@
WeakCallCounter* counter) {
CHECK_EQ(1234, counter->id());
counter->increment();
- handle->Dispose();
+ handle->Reset();
}
@@ -3509,15 +3496,15 @@
{
HandleScope scope(iso);
g1s1.Reset(iso, Object::New());
- g1s2.Reset(iso, String::New("foo1"));
- g1c1.Reset(iso, String::New("foo2"));
+ g1s2.Reset(iso, String::NewFromUtf8(iso, "foo1"));
+ g1c1.Reset(iso, String::NewFromUtf8(iso, "foo2"));
g1s1.MakeWeak(&counter, &WeakPointerCallback);
g1s2.MakeWeak(&counter, &WeakPointerCallback);
g1c1.MakeWeak(&counter, &WeakPointerCallback);
g2s1.Reset(iso, Object::New());
- g2s2.Reset(iso, String::New("foo3"));
- g2c1.Reset(iso, String::New("foo4"));
+ g2s2.Reset(iso, String::NewFromUtf8(iso, "foo3"));
+ g2c1.Reset(iso, String::NewFromUtf8(iso, "foo4"));
g2s1.MakeWeak(&counter, &WeakPointerCallback);
g2s2.MakeWeak(&counter, &WeakPointerCallback);
g2c1.MakeWeak(&counter, &WeakPointerCallback);
@@ -4269,8 +4256,8 @@
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
v8::V8::IgnoreOutOfMemoryException();
- Local<Script> script =
- Script::Compile(String::New(js_code_causing_out_of_memory));
+ Local<Script> script = Script::Compile(String::NewFromUtf8(
+ context->GetIsolate(), js_code_causing_out_of_memory));
Local<Value> result = script->Run();
// Check for out of memory state.
@@ -4284,8 +4271,8 @@
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- Local<Script> script =
- Script::Compile(String::New(js_code_causing_out_of_memory));
+ Local<Script> script = Script::Compile(String::NewFromUtf8(
+ context->GetIsolate(), js_code_causing_out_of_memory));
Local<Value> result = script->Run();
// Check for out of memory state.
@@ -5175,7 +5162,7 @@
v8::Handle<v8::Object> obj = v8::Object::New();
v8::Persistent<v8::Object> alias(isolate, obj);
CHECK(v8::Local<v8::Object>::New(isolate, alias)->StrictEquals(obj));
- alias.Dispose();
+ alias.Reset();
CHECK(v8_str("a")->SameValue(v8_str("a")));
CHECK(!v8_str("a")->SameValue(v8_str("b")));
@@ -5500,8 +5487,7 @@
CHECK(xValue.IsEmpty());
script->Run();
CHECK_EQ(v8_num(4), Local<Value>::New(CcTest::isolate(), xValue));
- xValue.Dispose();
- xValue.Clear();
+ xValue.Reset();
}
}
@@ -5517,8 +5503,7 @@
CHECK(xValue.IsEmpty());
script->Run();
CHECK_EQ(v8_num(4), Local<Value>::New(CcTest::isolate(), xValue));
- xValue.Dispose();
- xValue.Clear();
+ xValue.Reset();
}
}
@@ -6308,7 +6293,8 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- Local<String> obj = String::NewUndetectable("foo");
+ Local<String> obj = String::NewFromUtf8(env->GetIsolate(), "foo",
+ String::kUndetectableString);
env->Global()->Set(v8_str("undetectable"), obj);
ExpectString("undetectable", "foo");
@@ -6349,7 +6335,8 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- Local<String> obj = String::NewUndetectable("foo");
+ Local<String> obj = String::NewFromUtf8(env->GetIsolate(), "foo",
+ String::kUndetectableString);
env->Global()->Set(v8_str("undetectable"), obj);
env->Global()->Set(v8_str("detectable"), v8_str("bar"));
@@ -6384,13 +6371,13 @@
USE(PersistentHandles);
Local<String> str = v8_str("foo");
v8::Persistent<String> p_str(isolate, str);
- p_str.Dispose();
+ p_str.Reset();
Local<Script> scr = Script::Compile(v8_str(""));
v8::Persistent<Script> p_scr(isolate, scr);
- p_scr.Dispose();
+ p_scr.Reset();
Local<ObjectTemplate> templ = ObjectTemplate::New();
v8::Persistent<ObjectTemplate> p_templ(isolate, templ);
- p_templ.Dispose();
+ p_templ.Reset();
}
@@ -6697,7 +6684,8 @@
v8::HandleScope handle_scope(CcTest::isolate());
v8::ExtensionConfiguration config(1, &name);
LocalContext context(&config);
- CHECK_EQ(String::New(expected), context->Global()->Get(v8_str("loaded")));
+ CHECK_EQ(String::NewFromUtf8(CcTest::isolate(), expected),
+ context->Global()->Get(v8_str("loaded")));
}
@@ -6854,8 +6842,8 @@
v8::HandleScope scope(CcTest::isolate());
v8::V8::SetFatalErrorHandler(OOMCallback);
LocalContext context;
- Local<Script> script =
- Script::Compile(String::New(js_code_causing_huge_string_flattening));
+ Local<Script> script = Script::Compile(String::NewFromUtf8(
+ CcTest::isolate(), js_code_causing_huge_string_flattening));
last_location = NULL;
script->Run();
@@ -6892,7 +6880,7 @@
class Whammy {
public:
explicit Whammy(v8::Isolate* isolate) : cursor_(0), isolate_(isolate) { }
- ~Whammy() { script_.Dispose(); }
+ ~Whammy() { script_.Reset(); }
v8::Handle<Script> getScript() {
if (script_.IsEmpty()) script_.Reset(isolate_, v8_compile("({}).blammo"));
return Local<Script>::New(isolate_, script_);
@@ -6925,7 +6913,6 @@
v8::Local<v8::Object>::New(info.GetIsolate(), prev)
->Set(v8_str("next"), obj);
prev.MakeWeak<Value, Snorkel>(new Snorkel(), &HandleWeakReference);
- whammy->objects_[whammy->cursor_].Clear();
}
whammy->objects_[whammy->cursor_].Reset(info.GetIsolate(), obj);
whammy->cursor_ = (whammy->cursor_ + 1) % Whammy::kObjectCount;
@@ -6966,7 +6953,7 @@
static void DisposeAndSetFlag(v8::Isolate* isolate,
v8::Persistent<v8::Object>* obj,
bool* data) {
- obj->Dispose();
+ obj->Reset();
*(data) = true;
}
@@ -7012,7 +6999,7 @@
static void ForceScavenge(v8::Isolate* isolate,
v8::Persistent<v8::Object>* obj,
bool* data) {
- obj->Dispose();
+ obj->Reset();
*(data) = true;
InvokeScavenge();
}
@@ -7021,7 +7008,7 @@
static void ForceMarkSweep(v8::Isolate* isolate,
v8::Persistent<v8::Object>* obj,
bool* data) {
- obj->Dispose();
+ obj->Reset();
*(data) = true;
InvokeMarkSweep();
}
@@ -7414,7 +7401,8 @@
v8::Handle<String> str = v8_str("abcde");
// abc<Icelandic eth><Unicode snowman>.
v8::Handle<String> str2 = v8_str("abc\303\260\342\230\203");
- v8::Handle<String> str3 = v8::String::New("abc\0def", 7);
+ v8::Handle<String> str3 = v8::String::NewFromUtf8(
+ context->GetIsolate(), "abc\0def", v8::String::kNormalString, 7);
const int kStride = 4; // Must match stride in for loops in JS below.
CompileRun(
"var left = '';"
@@ -7808,10 +7796,12 @@
return *is1 == *is2;
}
-
-static void SameSymbolHelper(const char* a, const char* b) {
- Handle<String> symbol1 = v8::String::NewSymbol(a);
- Handle<String> symbol2 = v8::String::NewSymbol(b);
+static void SameSymbolHelper(v8::Isolate* isolate, const char* a,
+ const char* b) {
+ Handle<String> symbol1 =
+ v8::String::NewFromUtf8(isolate, a, v8::String::kInternalizedString);
+ Handle<String> symbol2 =
+ v8::String::NewFromUtf8(isolate, b, v8::String::kInternalizedString);
CHECK(SameSymbol(symbol1, symbol2));
}
@@ -7820,17 +7810,23 @@
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- Handle<String> symbol1 = v8::String::NewSymbol("abc");
- Handle<String> symbol2 = v8::String::NewSymbol("abc");
+ Handle<String> symbol1 = v8::String::NewFromUtf8(
+ context->GetIsolate(), "abc", v8::String::kInternalizedString);
+ Handle<String> symbol2 = v8::String::NewFromUtf8(
+ context->GetIsolate(), "abc", v8::String::kInternalizedString);
CHECK(SameSymbol(symbol1, symbol2));
- SameSymbolHelper("\360\220\220\205", // 4 byte encoding.
+ SameSymbolHelper(context->GetIsolate(),
+ "\360\220\220\205", // 4 byte encoding.
"\355\240\201\355\260\205"); // 2 3-byte surrogates.
- SameSymbolHelper("\355\240\201\355\260\206", // 2 3-byte surrogates.
+ SameSymbolHelper(context->GetIsolate(),
+ "\355\240\201\355\260\206", // 2 3-byte surrogates.
"\360\220\220\206"); // 4 byte encoding.
- SameSymbolHelper("x\360\220\220\205", // 4 byte encoding.
+ SameSymbolHelper(context->GetIsolate(),
+ "x\360\220\220\205", // 4 byte encoding.
"x\355\240\201\355\260\205"); // 2 3-byte surrogates.
- SameSymbolHelper("x\355\240\201\355\260\206", // 2 3-byte surrogates.
+ SameSymbolHelper(context->GetIsolate(),
+ "x\355\240\201\355\260\206", // 2 3-byte surrogates.
"x\360\220\220\206"); // 4 byte encoding.
CompileRun(
"var sym0 = 'benedictus';"
@@ -7847,12 +7843,22 @@
"if (sym3.charCodeAt(2) != 0xdc07) throw sym1.charCodeAt(2);"
"if (sym4.length != 3) throw sym4;"
"if (sym4.charCodeAt(2) != 0xdc08) throw sym2.charCodeAt(2);");
- Handle<String> sym0 = v8::String::NewSymbol("benedictus");
- Handle<String> sym0b = v8::String::NewSymbol("S\303\270ren");
- Handle<String> sym1 = v8::String::NewSymbol("\355\240\201\355\260\207");
- Handle<String> sym2 = v8::String::NewSymbol("\360\220\220\210");
- Handle<String> sym3 = v8::String::NewSymbol("x\355\240\201\355\260\207");
- Handle<String> sym4 = v8::String::NewSymbol("x\360\220\220\210");
+ Handle<String> sym0 = v8::String::NewFromUtf8(
+ context->GetIsolate(), "benedictus", v8::String::kInternalizedString);
+ Handle<String> sym0b = v8::String::NewFromUtf8(
+ context->GetIsolate(), "S\303\270ren", v8::String::kInternalizedString);
+ Handle<String> sym1 =
+ v8::String::NewFromUtf8(context->GetIsolate(), "\355\240\201\355\260\207",
+ v8::String::kInternalizedString);
+ Handle<String> sym2 =
+ v8::String::NewFromUtf8(context->GetIsolate(), "\360\220\220\210",
+ v8::String::kInternalizedString);
+ Handle<String> sym3 = v8::String::NewFromUtf8(
+ context->GetIsolate(), "x\355\240\201\355\260\207",
+ v8::String::kInternalizedString);
+ Handle<String> sym4 =
+ v8::String::NewFromUtf8(context->GetIsolate(), "x\360\220\220\210",
+ v8::String::kInternalizedString);
v8::Local<v8::Object> global = context->Global();
Local<Value> s0 = global->Get(v8_str("sym0"));
Local<Value> s0b = global->Get(v8_str("sym0b"));
@@ -8083,10 +8089,13 @@
v8::Local<v8::Object> global = env->Global();
global->Set(v8_str("trouble"), fun->GetFunction());
- Script::Compile(v8_str("function trouble() {\n"
- " var o = {};\n"
- " new o.foo();\n"
- "};"), v8::String::New(script_resource_name))->Run();
+ Script::Compile(
+ v8_str(
+ "function trouble() {\n"
+ " var o = {};\n"
+ " new o.foo();\n"
+ "};"),
+ v8::String::NewFromUtf8(env->GetIsolate(), script_resource_name))->Run();
Local<Value> trouble = global->Get(v8_str("trouble"));
CHECK(trouble->IsFunction());
Function::Cast(*trouble)->Call(global, 0, NULL);
@@ -13035,7 +13044,7 @@
void*) {
v8::HandleScope scope(isolate);
bad_handle.Reset(isolate, some_object);
- handle->Dispose();
+ handle->Reset();
}
@@ -13055,7 +13064,7 @@
// in reverse allocation order, so if second allocated handle is deleted,
// weak callback of the first handle would be able to 'reallocate' it.
handle1.MakeWeak<v8::Value, void>(NULL, NewPersistentHandleCallback);
- handle2.Dispose();
+ handle2.Reset();
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
}
@@ -13065,9 +13074,9 @@
void DisposeAndForceGcCallback(v8::Isolate* isolate,
v8::Persistent<v8::Value>* handle,
void*) {
- to_be_disposed.Dispose();
+ to_be_disposed.Reset();
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
- handle->Dispose();
+ handle->Reset();
}
@@ -13089,7 +13098,7 @@
void DisposingCallback(v8::Isolate* isolate,
v8::Persistent<v8::Value>* handle,
void*) {
- handle->Dispose();
+ handle->Reset();
}
void HandleCreatingCallback(v8::Isolate* isolate,
@@ -13097,7 +13106,7 @@
void*) {
v8::HandleScope scope(isolate);
v8::Persistent<v8::Object>(isolate, v8::Object::New());
- handle->Dispose();
+ handle->Reset();
}
@@ -13788,7 +13797,8 @@
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
v8::TryCatch try_catch;
- v8::Handle<v8::Script> script = v8::Script::Compile(v8::String::New(
+ v8::Handle<v8::Script> script = v8::Script::Compile(v8::String::NewFromUtf8(
+ context->GetIsolate(),
"function f() {"
" return f();"
"}"
@@ -13824,7 +13834,8 @@
THREADED_TEST(TryCatchSourceInfo) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::Handle<v8::String> source = v8::String::New(
+ v8::Handle<v8::String> source = v8::String::NewFromUtf8(
+ context->GetIsolate(),
"function Foo() {\n"
" return Bar();\n"
"}\n"
@@ -13842,16 +13853,20 @@
const char* resource_name;
v8::Handle<v8::Script> script;
resource_name = "test.js";
- script = v8::Script::Compile(source, v8::String::New(resource_name));
+ script = v8::Script::Compile(
+ source, v8::String::NewFromUtf8(context->GetIsolate(), resource_name));
CheckTryCatchSourceInfo(script, resource_name, 0);
resource_name = "test1.js";
- v8::ScriptOrigin origin1(v8::String::New(resource_name));
+ v8::ScriptOrigin origin1(
+ v8::String::NewFromUtf8(context->GetIsolate(), resource_name));
script = v8::Script::Compile(source, &origin1);
CheckTryCatchSourceInfo(script, resource_name, 0);
resource_name = "test2.js";
- v8::ScriptOrigin origin2(v8::String::New(resource_name), v8::Integer::New(7));
+ v8::ScriptOrigin origin2(
+ v8::String::NewFromUtf8(context->GetIsolate(), resource_name),
+ v8::Integer::New(7));
script = v8::Script::Compile(source, &origin2);
CheckTryCatchSourceInfo(script, resource_name, 7);
}
@@ -13860,12 +13875,14 @@
THREADED_TEST(CompilationCache) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::Handle<v8::String> source0 = v8::String::New("1234");
- v8::Handle<v8::String> source1 = v8::String::New("1234");
- v8::Handle<v8::Script> script0 =
- v8::Script::Compile(source0, v8::String::New("test.js"));
- v8::Handle<v8::Script> script1 =
- v8::Script::Compile(source1, v8::String::New("test.js"));
+ v8::Handle<v8::String> source0 =
+ v8::String::NewFromUtf8(context->GetIsolate(), "1234");
+ v8::Handle<v8::String> source1 =
+ v8::String::NewFromUtf8(context->GetIsolate(), "1234");
+ v8::Handle<v8::Script> script0 = v8::Script::Compile(
+ source0, v8::String::NewFromUtf8(context->GetIsolate(), "test.js"));
+ v8::Handle<v8::Script> script1 = v8::Script::Compile(
+ source1, v8::String::NewFromUtf8(context->GetIsolate(), "test.js"));
v8::Handle<v8::Script> script2 =
v8::Script::Compile(source0); // different origin
CHECK_EQ(1234, script0->Run()->Int32Value());
@@ -13930,7 +13947,8 @@
THREADED_TEST(PropertyEnumeration) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::Handle<v8::Value> obj = v8::Script::Compile(v8::String::New(
+ v8::Handle<v8::Value> obj = v8::Script::Compile(v8::String::NewFromUtf8(
+ context->GetIsolate(),
"var result = [];"
"result[0] = {};"
"result[1] = {a: 1, b: 2};"
@@ -13965,7 +13983,8 @@
THREADED_TEST(PropertyEnumeration2) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
- v8::Handle<v8::Value> obj = v8::Script::Compile(v8::String::New(
+ v8::Handle<v8::Value> obj = v8::Script::Compile(v8::String::NewFromUtf8(
+ context->GetIsolate(),
"var result = [];"
"result[0] = {};"
"result[1] = {a: 1, b: 2};"
@@ -14365,7 +14384,7 @@
sd_data[kHeaderSize + 1 * kFunctionEntrySize + kFunctionEntryEndOffset] = 0;
v8::TryCatch try_catch;
- Local<String> source = String::New(script);
+ Local<String> source = String::NewFromUtf8(isolate, script);
Local<Script> compiled_script = Script::New(source, NULL, sd);
CHECK(try_catch.HasCaught());
String::Utf8Value exception_value(try_catch.Message()->Get());
@@ -14405,7 +14424,7 @@
v8::String::NewExternal(resource));
v8::ScriptData* sd_from_string = v8::ScriptData::PreCompile(
- v8::String::New(cstring));
+ v8::String::NewFromUtf8(isolate, cstring));
CHECK_EQ(sd_from_cstring->Length(), sd_from_external_string->Length());
CHECK_EQ(0, memcmp(sd_from_cstring->Data(),
@@ -14620,11 +14639,11 @@
const char* expected_slice_on_cons =
"ow is the time for all good men to come to the aid of the party"
"Now is the time for all good men to come to the aid of the part";
- CHECK_EQ(String::New(expected_cons),
+ CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_cons),
env->Global()->Get(v8_str("cons")));
- CHECK_EQ(String::New(expected_slice),
+ CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_slice),
env->Global()->Get(v8_str("slice")));
- CHECK_EQ(String::New(expected_slice_on_cons),
+ CHECK_EQ(String::NewFromUtf8(env->GetIsolate(), expected_slice_on_cons),
env->Global()->Get(v8_str("slice_on_cons")));
}
i::DeleteArray(two_byte_string);
@@ -14725,7 +14744,7 @@
timeout_thread.Join();
delete regexp_interruption_data.string_resource;
- regexp_interruption_data.string.Dispose();
+ regexp_interruption_data.string.Reset();
}
#endif // V8_INTERPRETED_REGEXP
@@ -14790,13 +14809,15 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New();
- v8::Handle<v8::String> access_property = v8::String::New("a");
+ v8::Handle<v8::String> access_property =
+ v8::String::NewFromUtf8(CcTest::isolate(), "a");
templ->SetAccessor(access_property, ForceSetGetter, ForceSetSetter);
LocalContext context(NULL, templ);
v8::Handle<v8::Object> global = context->Global();
// Ordinary properties
- v8::Handle<v8::String> simple_property = v8::String::New("p");
+ v8::Handle<v8::String> simple_property =
+ v8::String::NewFromUtf8(CcTest::isolate(), "p");
global->Set(simple_property, v8::Int32::New(4), v8::ReadOnly);
CHECK_EQ(4, global->Get(simple_property)->Int32Value());
// This should fail because the property is read-only
@@ -14836,7 +14857,8 @@
LocalContext context(NULL, templ);
v8::Handle<v8::Object> global = context->Global();
- v8::Handle<v8::String> some_property = v8::String::New("a");
+ v8::Handle<v8::String> some_property =
+ v8::String::NewFromUtf8(CcTest::isolate(), "a");
CHECK_EQ(0, force_set_set_count);
CHECK_EQ(0, force_set_get_count);
CHECK_EQ(3, global->Get(some_property)->Int32Value());
@@ -14866,7 +14888,8 @@
CHECK_EQ(1, force_set_set_count);
CHECK_EQ(5, force_set_get_count);
// The interceptor should also work for other properties
- CHECK_EQ(3, global->Get(v8::String::New("b"))->Int32Value());
+ CHECK_EQ(3, global->Get(v8::String::NewFromUtf8(CcTest::isolate(), "b"))
+ ->Int32Value());
CHECK_EQ(1, force_set_set_count);
CHECK_EQ(6, force_set_get_count);
}
@@ -14879,7 +14902,8 @@
v8::Handle<v8::Object> global = context->Global();
// Ordinary properties
- v8::Handle<v8::String> simple_property = v8::String::New("p");
+ v8::Handle<v8::String> simple_property =
+ v8::String::NewFromUtf8(CcTest::isolate(), "p");
global->Set(simple_property, v8::Int32::New(4), v8::DontDelete);
CHECK_EQ(4, global->Get(simple_property)->Int32Value());
// This should fail because the property is dont-delete.
@@ -14914,7 +14938,8 @@
LocalContext context(NULL, templ);
v8::Handle<v8::Object> global = context->Global();
- v8::Handle<v8::String> some_property = v8::String::New("a");
+ v8::Handle<v8::String> some_property =
+ v8::String::NewFromUtf8(CcTest::isolate(), "a");
global->Set(some_property, v8::Integer::New(42), v8::DontDelete);
// Deleting a property should get intercepted and nothing should
@@ -14980,7 +15005,8 @@
"f();");
CHECK_EQ(42, res->Int32Value());
ctx2->Exit();
- v8::Handle<v8::String> G_property = v8::String::New("G");
+ v8::Handle<v8::String> G_property =
+ v8::String::NewFromUtf8(CcTest::isolate(), "G");
CHECK(ctx1->Global()->ForceDelete(G_property));
ctx2->Enter();
ExpectString(
@@ -15098,10 +15124,12 @@
v8::HandleScope scope(context->GetIsolate());
v8::Handle<v8::Object> obj = v8::Object::New();
v8::Handle<v8::FunctionTemplate> func_templ = v8::FunctionTemplate::New();
- v8::Handle<v8::String> foo_string = v8::String::New("foo");
+ v8::Handle<v8::String> foo_string =
+ v8::String::NewFromUtf8(context->GetIsolate(), "foo");
obj->Set(foo_string, func_templ->GetFunction());
v8::Handle<v8::Object> obj_clone = obj->Clone();
- obj_clone->Set(foo_string, v8::String::New("Hello"));
+ obj_clone->Set(foo_string,
+ v8::String::NewFromUtf8(context->GetIsolate(), "Hello"));
CHECK(!obj->Get(foo_string)->IsUndefined());
}
@@ -16410,13 +16438,17 @@
LocalContext c1;
v8::HandleScope scope(c1->GetIsolate());
const char *source = "foo";
- v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source));
- v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source));
- c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100));
+ v8::Handle<v8::Script> dep =
+ v8::Script::Compile(v8::String::NewFromUtf8(c1->GetIsolate(), source));
+ v8::Handle<v8::Script> indep =
+ v8::Script::New(v8::String::NewFromUtf8(c1->GetIsolate(), source));
+ c1->Global()->Set(v8::String::NewFromUtf8(c1->GetIsolate(), "foo"),
+ v8::Integer::New(100));
CHECK_EQ(dep->Run()->Int32Value(), 100);
CHECK_EQ(indep->Run()->Int32Value(), 100);
LocalContext c2;
- c2->Global()->Set(v8::String::New("foo"), v8::Integer::New(101));
+ c2->Global()->Set(v8::String::NewFromUtf8(c2->GetIsolate(), "foo"),
+ v8::Integer::New(101));
CHECK_EQ(dep->Run()->Int32Value(), 100);
CHECK_EQ(indep->Run()->Int32Value(), 101);
}
@@ -16427,8 +16459,10 @@
v8::HandleScope scope(context->GetIsolate());
v8::TryCatch try_catch;
const char *source = "function foo() { FAIL.FAIL; }; foo();";
- v8::Handle<v8::String> src = v8::String::New(source);
- v8::Handle<v8::String> origin = v8::String::New("stack-trace-test");
+ v8::Handle<v8::String> src =
+ v8::String::NewFromUtf8(context->GetIsolate(), source);
+ v8::Handle<v8::String> origin =
+ v8::String::NewFromUtf8(context->GetIsolate(), "stack-trace-test");
v8::Script::New(src, origin)->Run();
CHECK(try_catch.HasCaught());
v8::String::Utf8Value stack(try_catch.StackTrace());
@@ -16514,7 +16548,8 @@
// THREADED_TEST(CaptureStackTrace) {
TEST(CaptureStackTrace) {
v8::HandleScope scope(CcTest::isolate());
- v8::Handle<v8::String> origin = v8::String::New("capture-stack-trace-test");
+ v8::Handle<v8::String> origin =
+ v8::String::NewFromUtf8(CcTest::isolate(), "capture-stack-trace-test");
Local<ObjectTemplate> templ = ObjectTemplate::New();
templ->Set(v8_str("AnalyzeStackInNativeCode"),
v8::FunctionTemplate::New(AnalyzeStackInNativeCode));
@@ -16531,7 +16566,8 @@
" bar();\n"
"}\n"
"var x;eval('new foo();');";
- v8::Handle<v8::String> overview_src = v8::String::New(overview_source);
+ v8::Handle<v8::String> overview_src =
+ v8::String::NewFromUtf8(CcTest::isolate(), overview_source);
v8::Handle<Value> overview_result(
v8::Script::New(overview_src, origin)->Run());
CHECK(!overview_result.IsEmpty());
@@ -16546,7 +16582,8 @@
" bat();\n"
"}\n"
"eval('new baz();');";
- v8::Handle<v8::String> detailed_src = v8::String::New(detailed_source);
+ v8::Handle<v8::String> detailed_src =
+ v8::String::NewFromUtf8(CcTest::isolate(), detailed_source);
// Make the script using a non-zero line and column offset.
v8::Handle<v8::Integer> line_offset = v8::Integer::New(3);
v8::Handle<v8::Integer> column_offset = v8::Integer::New(5);
@@ -16810,12 +16847,14 @@
v8::FunctionTemplate::New(AnalyzeScriptIdInStack));
LocalContext context(0, templ);
- v8::Handle<v8::String> scriptSource = v8::String::New(
+ v8::Handle<v8::String> scriptSource = v8::String::NewFromUtf8(
+ CcTest::isolate(),
"function foo() {\n"
" AnalyzeScriptIdInStack();"
"}\n"
"foo();\n");
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
+ v8::ScriptOrigin origin =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(CcTest::isolate(), "test"));
v8::Local<v8::Script> script(v8::Script::Compile(scriptSource, &origin));
script->Run();
for (int i = 0; i < 2; i++) {
@@ -17164,7 +17203,8 @@
// Externalized symbol.
resource[2] = new TestResource(two_byte_string);
- v8::Local<v8::String> string2 = v8::String::NewSymbol(string);
+ v8::Local<v8::String> string2 = v8::String::NewFromUtf8(
+ env->GetIsolate(), string, v8::String::kInternalizedString);
CHECK(string2->MakeExternal(resource[2]));
// Symbolized External.
@@ -17188,6 +17228,26 @@
}
+TEST(ExternalStringCollectedAtTearDown) {
+ int destroyed = 0;
+ v8::Isolate* isolate = v8::Isolate::New();
+ { v8::Isolate::Scope isolate_scope(isolate);
+ v8::HandleScope handle_scope(isolate);
+ const char* s = "One string to test them all, one string to find them.";
+ TestAsciiResource* inscription =
+ new TestAsciiResource(i::StrDup(s), &destroyed);
+ v8::Local<v8::String> ring = v8::String::NewExternal(inscription);
+ // Ring is still alive. Orcs are roaming freely across our lands.
+ CHECK_EQ(0, destroyed);
+ USE(ring);
+ }
+
+ isolate->Dispose();
+ // Ring has been destroyed. Free Peoples of Middle-earth Rejoice.
+ CHECK_EQ(1, destroyed);
+}
+
+
static double DoubleFromBits(uint64_t value) {
double target;
i::OS::MemCopy(&target, &value, sizeof(target));
@@ -17319,7 +17379,7 @@
v8::HandleScope scope(CcTest::isolate());
LocalContext context;
context->Global()->Set(
- v8::String::New("s"),
+ v8::String::NewFromUtf8(CcTest::isolate(), "s"),
v8::FunctionTemplate::New(SpaghettiIncident)->GetFunction());
v8::TryCatch try_catch;
CompileRun(
@@ -17360,7 +17420,7 @@
v8::Local<Context> context = Context::New(isolate);
context->Enter();
- Local<v8::String> obj = v8::String::New("");
+ Local<v8::String> obj = v8::String::NewFromUtf8(isolate, "");
context->SetEmbedderData(0, obj);
CompileRun(source_simple);
context->Exit();
@@ -17432,14 +17492,15 @@
THREADED_TEST(ScriptOrigin) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
- v8::Handle<v8::String> script = v8::String::New(
- "function f() {}\n\nfunction g() {}");
+ v8::ScriptOrigin origin =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
+ v8::Handle<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(), "function f() {}\n\nfunction g() {}");
v8::Script::Compile(script, &origin)->Run();
v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("f")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("g")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
v8::ScriptOrigin script_origin_f = f->GetScriptOrigin();
CHECK_EQ("test", *v8::String::Utf8Value(script_origin_f.ResourceName()));
@@ -17454,12 +17515,14 @@
THREADED_TEST(FunctionGetInferredName) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
- v8::Handle<v8::String> script = v8::String::New(
+ v8::ScriptOrigin origin =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
+ v8::Handle<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(),
"var foo = { bar : { baz : function() {}}}; var f = foo.bar.baz;");
v8::Script::Compile(script, &origin)->Run();
v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("f")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
CHECK_EQ("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName()));
}
@@ -17500,23 +17563,26 @@
" arguments.callee.displayName = 'set_in_runtime';"
"}; g();"
;
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
- v8::Script::Compile(v8::String::New(code), &origin)->Run();
- v8::Local<v8::Value> error = env->Global()->Get(v8::String::New("error"));
+ v8::ScriptOrigin origin =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), code), &origin)
+ ->Run();
+ v8::Local<v8::Value> error =
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "error"));
v8::Local<v8::Function> a = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("a")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "a")));
v8::Local<v8::Function> b = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("b")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "b")));
v8::Local<v8::Function> c = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("c")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "c")));
v8::Local<v8::Function> d = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("d")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "d")));
v8::Local<v8::Function> e = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("e")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "e")));
v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("f")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("g")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
CHECK_EQ(false, error->BooleanValue());
CHECK_EQ("display_a", *v8::String::Utf8Value(a->GetDisplayName()));
CHECK_EQ("display_b", *v8::String::Utf8Value(b->GetDisplayName()));
@@ -17531,14 +17597,15 @@
THREADED_TEST(ScriptLineNumber) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
- v8::Handle<v8::String> script = v8::String::New(
- "function f() {}\n\nfunction g() {}");
+ v8::ScriptOrigin origin =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
+ v8::Handle<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(), "function f() {}\n\nfunction g() {}");
v8::Script::Compile(script, &origin)->Run();
v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("f")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("g")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
CHECK_EQ(0, f->GetScriptLineNumber());
CHECK_EQ(2, g->GetScriptLineNumber());
}
@@ -17547,15 +17614,16 @@
THREADED_TEST(ScriptColumnNumber) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"),
- v8::Integer::New(3), v8::Integer::New(2));
- v8::Handle<v8::String> script = v8::String::New(
- "function foo() {}\n\n function bar() {}");
+ v8::ScriptOrigin origin =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"),
+ v8::Integer::New(3), v8::Integer::New(2));
+ v8::Handle<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(), "function foo() {}\n\n function bar() {}");
v8::Script::Compile(script, &origin)->Run();
v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("foo")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("bar")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "bar")));
CHECK_EQ(14, foo->GetScriptColumnNumber());
CHECK_EQ(17, bar->GetScriptColumnNumber());
}
@@ -17581,18 +17649,19 @@
THREADED_TEST(FunctionGetScriptId) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"),
- v8::Integer::New(3), v8::Integer::New(2));
- v8::Handle<v8::String> scriptSource = v8::String::New(
- "function foo() {}\n\n function bar() {}");
+ v8::ScriptOrigin origin =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"),
+ v8::Integer::New(3), v8::Integer::New(2));
+ v8::Handle<v8::String> scriptSource = v8::String::NewFromUtf8(
+ env->GetIsolate(), "function foo() {}\n\n function bar() {}");
v8::Local<v8::Script> script(v8::Script::Compile(scriptSource, &origin));
script->Run();
v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("foo")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("bar")));
- CHECK_EQ(script->Id(), foo->GetScriptId());
- CHECK_EQ(script->Id(), bar->GetScriptId());
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "bar")));
+ CHECK_EQ(script->GetId(), foo->ScriptId());
+ CHECK_EQ(script->GetId(), bar->ScriptId());
}
@@ -18388,10 +18457,10 @@
{
v8::Isolate::Scope iscope(isolate2);
- context2.Dispose();
+ context2.Reset();
}
- context1.Dispose();
+ context1.Reset();
isolate1->Exit();
v8::V8::SetFatalErrorHandler(StoringErrorCallback);
@@ -18806,7 +18875,7 @@
v8::V8::VisitHandlesWithClassIds(&visitor);
CHECK_EQ(1, visitor.counter_);
- object.Dispose();
+ object.Reset();
}
@@ -18818,7 +18887,7 @@
CHECK_EQ(0, object.WrapperClassId());
object.SetWrapperClassId(65535);
CHECK_EQ(65535, object.WrapperClassId());
- object.Dispose();
+ object.Reset();
}
@@ -18842,8 +18911,8 @@
v8::V8::VisitHandlesForPartialDependence(isolate, &visitor);
CHECK_EQ(1, visitor.counter_);
- object1.Dispose();
- object2.Dispose();
+ object1.Reset();
+ object2.Reset();
}
@@ -19658,8 +19727,8 @@
v8::V8::AddCallCompletedCallback(CallCompletedCallback1);
v8::V8::AddCallCompletedCallback(CallCompletedCallback2);
i::OS::Print("--- Script (1) ---\n");
- Local<Script> script =
- v8::Script::Compile(v8::String::New("recursion(0)"));
+ Local<Script> script = v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "recursion(0)"));
script->Run();
CHECK_EQ(3, callback_fired);
@@ -20272,7 +20341,7 @@
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
Local<Object> obj = Object::New();
- Local<String> key = String::New("key");
+ Local<String> key = String::NewFromUtf8(context->GetIsolate(), "key");
obj->SetHiddenValue(key, v8::Undefined(isolate));
Local<Value> value = obj->GetHiddenValue(key);
CHECK(!value.IsEmpty());
diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc
index 3cef716..b2a0199 100644
--- a/test/cctest/test-compiler.cc
+++ b/test/cctest/test-compiler.cc
@@ -331,7 +331,8 @@
TEST(GetScriptLineNumber) {
LocalContext context;
v8::HandleScope scope(CcTest::isolate());
- v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
+ v8::ScriptOrigin origin =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(CcTest::isolate(), "test"));
const char function_f[] = "function f() {}";
const int max_rows = 1000;
const int buffer_size = max_rows + sizeof(function_f);
@@ -343,10 +344,12 @@
if (i > 0)
buffer[i - 1] = '\n';
OS::MemCopy(&buffer[i], function_f, sizeof(function_f) - 1);
- v8::Handle<v8::String> script_body = v8::String::New(buffer.start());
+ v8::Handle<v8::String> script_body =
+ v8::String::NewFromUtf8(CcTest::isolate(), buffer.start());
v8::Script::Compile(script_body, &origin)->Run();
- v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
- context->Global()->Get(v8::String::New("f")));
+ v8::Local<v8::Function> f =
+ v8::Local<v8::Function>::Cast(context->Global()->Get(
+ v8::String::NewFromUtf8(CcTest::isolate(), "f")));
CHECK_EQ(i, f->GetScriptLineNumber());
}
}
@@ -364,7 +367,8 @@
v8::HandleScope scope(CcTest::isolate());
for (int i = 0; i < 10; i++) {
LocalContext env;
- env->Global()->Set(v8::String::New("x"), v8::Integer::New(i));
+ env->Global()->Set(v8::String::NewFromUtf8(CcTest::isolate(), "x"),
+ v8::Integer::New(i));
CompileRun("function MakeClosure() {"
" return function() { return x; };"
"}"
diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc
index 33444ea..c847afc 100644
--- a/test/cctest/test-cpu-profiler.cc
+++ b/test/cctest/test-cpu-profiler.cc
@@ -355,7 +355,7 @@
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
CHECK_EQ(0, cpu_profiler->GetProfileCount());
- v8::Local<v8::String> name1 = v8::String::New("1");
+ v8::Local<v8::String> name1 = v8::String::NewFromUtf8(env->GetIsolate(), "1");
cpu_profiler->StartCpuProfiling(name1);
const v8::CpuProfile* p1 = cpu_profiler->StopCpuProfiling(name1);
CHECK_NE(NULL, p1);
@@ -366,7 +366,7 @@
CHECK_EQ(0, cpu_profiler->GetProfileCount());
CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid1));
- v8::Local<v8::String> name2 = v8::String::New("2");
+ v8::Local<v8::String> name2 = v8::String::NewFromUtf8(env->GetIsolate(), "2");
cpu_profiler->StartCpuProfiling(name2);
const v8::CpuProfile* p2 = cpu_profiler->StopCpuProfiling(name2);
CHECK_NE(NULL, p2);
@@ -375,7 +375,7 @@
CHECK_NE(static_cast<int>(uid1), static_cast<int>(uid2));
CHECK_EQ(p2, FindCpuProfile(cpu_profiler, uid2));
CHECK_EQ(NULL, FindCpuProfile(cpu_profiler, uid1));
- v8::Local<v8::String> name3 = v8::String::New("3");
+ v8::Local<v8::String> name3 = v8::String::NewFromUtf8(env->GetIsolate(), "3");
cpu_profiler->StartCpuProfiling(name3);
const v8::CpuProfile* p3 = cpu_profiler->StopCpuProfiling(name3);
CHECK_NE(NULL, p3);
@@ -401,7 +401,8 @@
v8::HandleScope scope(env->GetIsolate());
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
- v8::Local<v8::String> profile_name = v8::String::New("test");
+ v8::Local<v8::String> profile_name =
+ v8::String::NewFromUtf8(env->GetIsolate(), "test");
cpu_profiler->StartCpuProfiling(profile_name);
const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name);
CHECK(profile->GetStartTime() <= profile->GetEndTime());
@@ -413,7 +414,8 @@
v8::Handle<v8::Value> argv[], int argc,
unsigned min_js_samples) {
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
- v8::Local<v8::String> profile_name = v8::String::New("my_profile");
+ v8::Local<v8::String> profile_name =
+ v8::String::NewFromUtf8(env->GetIsolate(), "my_profile");
cpu_profiler->StartCpuProfiling(profile_name);
@@ -460,10 +462,11 @@
}
-static const v8::CpuProfileNode* FindChild(const v8::CpuProfileNode* node,
+static const v8::CpuProfileNode* FindChild(v8::Isolate* isolate,
+ const v8::CpuProfileNode* node,
const char* name) {
int count = node->GetChildrenCount();
- v8::Handle<v8::String> nameHandle = v8::String::New(name);
+ v8::Handle<v8::String> nameHandle = v8::String::NewFromUtf8(isolate, name);
for (int i = 0; i < count; i++) {
const v8::CpuProfileNode* child = node->GetChild(i);
if (nameHandle->Equals(child->GetFunctionName())) return child;
@@ -472,9 +475,10 @@
}
-static const v8::CpuProfileNode* GetChild(const v8::CpuProfileNode* node,
+static const v8::CpuProfileNode* GetChild(v8::Isolate* isolate,
+ const v8::CpuProfileNode* node,
const char* name) {
- const v8::CpuProfileNode* result = FindChild(node, name);
+ const v8::CpuProfileNode* result = FindChild(isolate, node, name);
if (!result) {
char buffer[100];
i::OS::SNPrintF(Vector<char>(buffer, ARRAY_SIZE(buffer)),
@@ -485,11 +489,12 @@
}
-static void CheckSimpleBranch(const v8::CpuProfileNode* node,
+static void CheckSimpleBranch(v8::Isolate* isolate,
+ const v8::CpuProfileNode* node,
const char* names[], int length) {
for (int i = 0; i < length; i++) {
const char* name = names[i];
- node = GetChild(node, name);
+ node = GetChild(isolate, node, name);
int expectedChildrenCount = (i == length - 1) ? 0 : 1;
CHECK_EQ(expectedChildrenCount, node->GetChildrenCount());
}
@@ -549,9 +554,10 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::Script::Compile(v8::String::New(cpu_profiler_test_source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ cpu_profiler_test_source))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t profiling_interval_ms = 200;
v8::Handle<v8::Value> args[] = { v8::Integer::New(profiling_interval_ms) };
@@ -562,23 +568,30 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
ScopedVector<v8::Handle<v8::String> > names(3);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New("start");
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
CheckChildrenNames(root, names);
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
CHECK_EQ(1, startNode->GetChildrenCount());
- const v8::CpuProfileNode* fooNode = GetChild(startNode, "foo");
+ const v8::CpuProfileNode* fooNode =
+ GetChild(env->GetIsolate(), startNode, "foo");
CHECK_EQ(3, fooNode->GetChildrenCount());
const char* barBranch[] = { "bar", "delay", "loop" };
- CheckSimpleBranch(fooNode, barBranch, ARRAY_SIZE(barBranch));
+ CheckSimpleBranch(env->GetIsolate(), fooNode, barBranch,
+ ARRAY_SIZE(barBranch));
const char* bazBranch[] = { "baz", "delay", "loop" };
- CheckSimpleBranch(fooNode, bazBranch, ARRAY_SIZE(bazBranch));
+ CheckSimpleBranch(env->GetIsolate(), fooNode, bazBranch,
+ ARRAY_SIZE(bazBranch));
const char* delayBranch[] = { "delay", "loop" };
- CheckSimpleBranch(fooNode, delayBranch, ARRAY_SIZE(delayBranch));
+ CheckSimpleBranch(env->GetIsolate(), fooNode, delayBranch,
+ ARRAY_SIZE(delayBranch));
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -610,9 +623,10 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::Script::Compile(v8::String::New(cpu_profiler_test_source2))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(
+ env->GetIsolate(), cpu_profiler_test_source2))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t repeat_count = 100;
#if defined(USE_SIMULATOR)
@@ -626,20 +640,24 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
ScopedVector<v8::Handle<v8::String> > names(3);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New("start");
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
CheckChildrenNames(root, names);
- const v8::CpuProfileNode* startNode = FindChild(root, "start");
+ const v8::CpuProfileNode* startNode =
+ FindChild(env->GetIsolate(), root, "start");
// On slow machines there may be no meaningfull samples at all, skip the
// check there.
if (startNode && startNode->GetChildrenCount() > 0) {
CHECK_EQ(1, startNode->GetChildrenCount());
- const v8::CpuProfileNode* delayNode = GetChild(startNode, "delay");
+ const v8::CpuProfileNode* delayNode =
+ GetChild(env->GetIsolate(), startNode, "delay");
if (delayNode->GetChildrenCount() > 0) {
CHECK_EQ(1, delayNode->GetChildrenCount());
- GetChild(delayNode, "loop");
+ GetChild(env->GetIsolate(), delayNode, "loop");
}
}
@@ -721,15 +739,18 @@
v8::Local<v8::External> data =
v8::External::New(env->GetIsolate(), &accessors);
instance_template->SetAccessor(
- v8::String::New("foo"), &TestApiCallbacks::Getter,
- &TestApiCallbacks::Setter, data);
+ v8::String::NewFromUtf8(env->GetIsolate(), "foo"),
+ &TestApiCallbacks::Getter, &TestApiCallbacks::Setter, data);
v8::Local<v8::Function> func = func_template->GetFunction();
v8::Local<v8::Object> instance = func->NewInstance();
- env->Global()->Set(v8::String::New("instance"), instance);
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "instance"),
+ instance);
- v8::Script::Compile(v8::String::New(native_accessor_test_source))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), native_accessor_test_source))
+ ->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t repeat_count = 1;
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) };
@@ -737,9 +758,10 @@
RunProfiler(env, function, args, ARRAY_SIZE(args), 180);
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
- GetChild(startNode, "get foo");
- GetChild(startNode, "set foo");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
+ GetChild(env->GetIsolate(), startNode, "get foo");
+ GetChild(env->GetIsolate(), startNode, "set foo");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -762,15 +784,18 @@
v8::Local<v8::External> data =
v8::External::New(env->GetIsolate(), &accessors);
instance_template->SetAccessor(
- v8::String::New("foo"), &TestApiCallbacks::Getter,
- &TestApiCallbacks::Setter, data);
+ v8::String::NewFromUtf8(env->GetIsolate(), "foo"),
+ &TestApiCallbacks::Getter, &TestApiCallbacks::Setter, data);
v8::Local<v8::Function> func = func_template->GetFunction();
v8::Local<v8::Object> instance = func->NewInstance();
- env->Global()->Set(v8::String::New("instance"), instance);
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "instance"),
+ instance);
- v8::Script::Compile(v8::String::New(native_accessor_test_source))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), native_accessor_test_source))
+ ->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
{
// Make sure accessors ICs are in monomorphic state before starting
@@ -788,9 +813,10 @@
RunProfiler(env, function, args, ARRAY_SIZE(args), 200);
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
- GetChild(startNode, "get foo");
- GetChild(startNode, "set foo");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
+ GetChild(env->GetIsolate(), startNode, "get foo");
+ GetChild(env->GetIsolate(), startNode, "set foo");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -813,20 +839,24 @@
v8::External::New(env->GetIsolate(), &callbacks);
v8::Local<v8::FunctionTemplate> func_template = v8::FunctionTemplate::New();
- func_template->SetClassName(v8::String::New("Test_InstanceCostructor"));
+ func_template->SetClassName(
+ v8::String::NewFromUtf8(env->GetIsolate(), "Test_InstanceCostructor"));
v8::Local<v8::ObjectTemplate> proto_template =
func_template->PrototypeTemplate();
v8::Local<v8::Signature> signature = v8::Signature::New(func_template);
- proto_template->Set(v8::String::New("fooMethod"), v8::FunctionTemplate::New(
- &TestApiCallbacks::Callback, data, signature, 0));
+ proto_template->Set(v8::String::NewFromUtf8(env->GetIsolate(), "fooMethod"),
+ v8::FunctionTemplate::New(&TestApiCallbacks::Callback,
+ data, signature, 0));
v8::Local<v8::Function> func = func_template->GetFunction();
v8::Local<v8::Object> instance = func->NewInstance();
- env->Global()->Set(v8::String::New("instance"), instance);
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "instance"),
+ instance);
- v8::Script::Compile(v8::String::New(native_method_test_source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(
+ env->GetIsolate(), native_method_test_source))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t repeat_count = 1;
v8::Handle<v8::Value> args[] = { v8::Integer::New(repeat_count) };
@@ -834,8 +864,9 @@
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
- GetChild(startNode, "fooMethod");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
+ GetChild(env->GetIsolate(), startNode, "fooMethod");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -851,20 +882,24 @@
v8::External::New(env->GetIsolate(), &callbacks);
v8::Local<v8::FunctionTemplate> func_template = v8::FunctionTemplate::New();
- func_template->SetClassName(v8::String::New("Test_InstanceCostructor"));
+ func_template->SetClassName(
+ v8::String::NewFromUtf8(env->GetIsolate(), "Test_InstanceCostructor"));
v8::Local<v8::ObjectTemplate> proto_template =
func_template->PrototypeTemplate();
v8::Local<v8::Signature> signature = v8::Signature::New(func_template);
- proto_template->Set(v8::String::New("fooMethod"), v8::FunctionTemplate::New(
- &TestApiCallbacks::Callback, data, signature, 0));
+ proto_template->Set(v8::String::NewFromUtf8(env->GetIsolate(), "fooMethod"),
+ v8::FunctionTemplate::New(&TestApiCallbacks::Callback,
+ data, signature, 0));
v8::Local<v8::Function> func = func_template->GetFunction();
v8::Local<v8::Object> instance = func->NewInstance();
- env->Global()->Set(v8::String::New("instance"), instance);
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "instance"),
+ instance);
- v8::Script::Compile(v8::String::New(native_method_test_source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(
+ env->GetIsolate(), native_method_test_source))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
{
// Make sure method ICs are in monomorphic state before starting
// profiling.
@@ -881,9 +916,10 @@
RunProfiler(env, function, args, ARRAY_SIZE(args), 100);
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
- GetChild(root, "start");
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
- GetChild(startNode, "fooMethod");
+ GetChild(env->GetIsolate(), root, "start");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
+ GetChild(env->GetIsolate(), startNode, "fooMethod");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -908,9 +944,11 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::Script::Compile(v8::String::New(bound_function_test_source))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), bound_function_test_source))
+ ->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
@@ -919,14 +957,17 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
ScopedVector<v8::Handle<v8::String> > names(3);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New("start");
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
// Don't allow |foo| node to be at the top level.
CheckChildrenNames(root, names);
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
- GetChild(startNode, "foo");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
+ GetChild(env->GetIsolate(), startNode, "foo");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -964,9 +1005,10 @@
// Collect garbage that might have be generated while installing extensions.
CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
- v8::Script::Compile(v8::String::New(call_function_test_source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(
+ env->GetIsolate(), call_function_test_source))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
@@ -976,10 +1018,13 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
{
ScopedVector<v8::Handle<v8::String> > names(4);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New("start");
- names[3] = v8::String::New(i::ProfileGenerator::kUnresolvedFunctionName);
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
+ names[3] = v8::String::NewFromUtf8(
+ env->GetIsolate(), i::ProfileGenerator::kUnresolvedFunctionName);
// Don't allow |bar| and |call| nodes to be at the top level.
CheckChildrenNames(root, names);
}
@@ -988,20 +1033,21 @@
// won't be |start| node in the profiles.
bool is_gc_stress_testing =
(i::FLAG_gc_interval != -1) || i::FLAG_stress_compaction;
- const v8::CpuProfileNode* startNode = FindChild(root, "start");
+ const v8::CpuProfileNode* startNode =
+ FindChild(env->GetIsolate(), root, "start");
CHECK(is_gc_stress_testing || startNode);
if (startNode) {
ScopedVector<v8::Handle<v8::String> > names(2);
- names[0] = v8::String::New("bar");
- names[1] = v8::String::New("call");
+ names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "bar");
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(), "call");
CheckChildrenNames(startNode, names);
}
- const v8::CpuProfileNode* unresolvedNode =
- FindChild(root, i::ProfileGenerator::kUnresolvedFunctionName);
+ const v8::CpuProfileNode* unresolvedNode = FindChild(
+ env->GetIsolate(), root, i::ProfileGenerator::kUnresolvedFunctionName);
if (unresolvedNode) {
ScopedVector<v8::Handle<v8::String> > names(1);
- names[0] = v8::String::New("call");
+ names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "call");
CheckChildrenNames(unresolvedNode, names);
}
@@ -1039,9 +1085,11 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::Script::Compile(v8::String::New(function_apply_test_source))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), function_apply_test_source))
+ ->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 100;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
@@ -1052,36 +1100,42 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
{
ScopedVector<v8::Handle<v8::String> > names(3);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New("start");
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
// Don't allow |test|, |bar| and |apply| nodes to be at the top level.
CheckChildrenNames(root, names);
}
- const v8::CpuProfileNode* startNode = FindChild(root, "start");
+ const v8::CpuProfileNode* startNode =
+ FindChild(env->GetIsolate(), root, "start");
if (startNode) {
{
ScopedVector<v8::Handle<v8::String> > names(2);
- names[0] = v8::String::New("test");
- names[1] = v8::String::New(ProfileGenerator::kUnresolvedFunctionName);
+ names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "test");
+ names[1] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kUnresolvedFunctionName);
CheckChildrenNames(startNode, names);
}
- const v8::CpuProfileNode* testNode = FindChild(startNode, "test");
+ const v8::CpuProfileNode* testNode =
+ FindChild(env->GetIsolate(), startNode, "test");
if (testNode) {
ScopedVector<v8::Handle<v8::String> > names(2);
- names[0] = v8::String::New("bar");
- names[1] = v8::String::New("apply");
+ names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "bar");
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(), "apply");
CheckChildrenNames(testNode, names);
}
if (const v8::CpuProfileNode* unresolvedNode =
- FindChild(startNode, ProfileGenerator::kUnresolvedFunctionName)) {
+ FindChild(env->GetIsolate(), startNode,
+ ProfileGenerator::kUnresolvedFunctionName)) {
ScopedVector<v8::Handle<v8::String> > names(1);
- names[0] = v8::String::New("apply");
+ names[0] = v8::String::NewFromUtf8(env->GetIsolate(), "apply");
CheckChildrenNames(unresolvedNode, names);
- GetChild(unresolvedNode, "apply");
+ GetChild(env->GetIsolate(), unresolvedNode, "apply");
}
}
@@ -1136,12 +1190,14 @@
v8::Local<v8::FunctionTemplate> func_template = v8::FunctionTemplate::New(
CallJsFunction);
v8::Local<v8::Function> func = func_template->GetFunction();
- func->SetName(v8::String::New("CallJsFunction"));
- env->Global()->Set(v8::String::New("CallJsFunction"), func);
+ func->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"));
+ env->Global()->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func);
- v8::Script::Compile(v8::String::New(js_native_js_test_source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ js_native_js_test_source))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
@@ -1151,22 +1207,26 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
{
ScopedVector<v8::Handle<v8::String> > names(3);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New("start");
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
CheckChildrenNames(root, names);
}
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
CHECK_EQ(1, startNode->GetChildrenCount());
const v8::CpuProfileNode* nativeFunctionNode =
- GetChild(startNode, "CallJsFunction");
+ GetChild(env->GetIsolate(), startNode, "CallJsFunction");
CHECK_EQ(1, nativeFunctionNode->GetChildrenCount());
- const v8::CpuProfileNode* barNode = GetChild(nativeFunctionNode, "bar");
+ const v8::CpuProfileNode* barNode =
+ GetChild(env->GetIsolate(), nativeFunctionNode, "bar");
CHECK_EQ(1, barNode->GetChildrenCount());
- GetChild(barNode, "foo");
+ GetChild(env->GetIsolate(), barNode, "foo");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -1214,13 +1274,15 @@
v8::Local<v8::FunctionTemplate> func_template = v8::FunctionTemplate::New(
CallJsFunction);
v8::Local<v8::Function> func = func_template->GetFunction();
- func->SetName(v8::String::New("CallJsFunction"));
- env->Global()->Set(v8::String::New("CallJsFunction"), func);
+ func->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"));
+ env->Global()->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction"), func);
- v8::Script::Compile(v8::String::New(js_native_js_runtime_js_test_source))->
- Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ js_native_js_runtime_js_test_source))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
@@ -1229,21 +1291,25 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
ScopedVector<v8::Handle<v8::String> > names(3);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New("start");
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
CheckChildrenNames(root, names);
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
CHECK_EQ(1, startNode->GetChildrenCount());
const v8::CpuProfileNode* nativeFunctionNode =
- GetChild(startNode, "CallJsFunction");
+ GetChild(env->GetIsolate(), startNode, "CallJsFunction");
CHECK_EQ(1, nativeFunctionNode->GetChildrenCount());
- const v8::CpuProfileNode* barNode = GetChild(nativeFunctionNode, "bar");
+ const v8::CpuProfileNode* barNode =
+ GetChild(env->GetIsolate(), nativeFunctionNode, "bar");
CHECK_EQ(1, barNode->GetChildrenCount());
- GetChild(barNode, "foo");
+ GetChild(env->GetIsolate(), barNode, "foo");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -1296,18 +1362,21 @@
v8::Local<v8::FunctionTemplate> func_template = v8::FunctionTemplate::New(
CallJsFunction);
v8::Local<v8::Function> func1 = func_template->GetFunction();
- func1->SetName(v8::String::New("CallJsFunction1"));
- env->Global()->Set(v8::String::New("CallJsFunction1"), func1);
+ func1->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction1"));
+ env->Global()->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction1"), func1);
v8::Local<v8::Function> func2 = v8::FunctionTemplate::New(
CallJsFunction2)->GetFunction();
- func2->SetName(v8::String::New("CallJsFunction2"));
- env->Global()->Set(v8::String::New("CallJsFunction2"), func2);
+ func2->SetName(v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction2"));
+ env->Global()->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "CallJsFunction2"), func2);
- v8::Script::Compile(v8::String::New(js_native1_js_native2_js_test_source))->
- Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ js_native1_js_native2_js_test_source))->Run();
v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("start")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "start")));
int32_t duration_ms = 20;
v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) };
@@ -1316,24 +1385,29 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
ScopedVector<v8::Handle<v8::String> > names(3);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New("start");
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(), "start");
CheckChildrenNames(root, names);
- const v8::CpuProfileNode* startNode = GetChild(root, "start");
+ const v8::CpuProfileNode* startNode =
+ GetChild(env->GetIsolate(), root, "start");
CHECK_EQ(1, startNode->GetChildrenCount());
const v8::CpuProfileNode* nativeNode1 =
- GetChild(startNode, "CallJsFunction1");
+ GetChild(env->GetIsolate(), startNode, "CallJsFunction1");
CHECK_EQ(1, nativeNode1->GetChildrenCount());
- const v8::CpuProfileNode* barNode = GetChild(nativeNode1, "bar");
+ const v8::CpuProfileNode* barNode =
+ GetChild(env->GetIsolate(), nativeNode1, "bar");
CHECK_EQ(1, barNode->GetChildrenCount());
- const v8::CpuProfileNode* nativeNode2 = GetChild(barNode, "CallJsFunction2");
+ const v8::CpuProfileNode* nativeNode2 =
+ GetChild(env->GetIsolate(), barNode, "CallJsFunction2");
CHECK_EQ(1, nativeNode2->GetChildrenCount());
- GetChild(nativeNode2, "foo");
+ GetChild(env->GetIsolate(), nativeNode2, "foo");
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
cpu_profiler->DeleteAllCpuProfiles();
@@ -1349,7 +1423,8 @@
v8::HandleScope scope(env->GetIsolate());
v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
- v8::Local<v8::String> profile_name = v8::String::New("my_profile");
+ v8::Local<v8::String> profile_name =
+ v8::String::NewFromUtf8(env->GetIsolate(), "my_profile");
cpu_profiler->StartCpuProfiling(profile_name);
i::Isolate* isolate = CcTest::i_isolate();
@@ -1374,18 +1449,21 @@
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
ScopedVector<v8::Handle<v8::String> > names(3);
- names[0] = v8::String::New(ProfileGenerator::kGarbageCollectorEntryName);
- names[1] = v8::String::New(ProfileGenerator::kProgramEntryName);
- names[2] = v8::String::New(ProfileGenerator::kIdleEntryName);
+ names[0] = v8::String::NewFromUtf8(
+ env->GetIsolate(), ProfileGenerator::kGarbageCollectorEntryName);
+ names[1] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kProgramEntryName);
+ names[2] = v8::String::NewFromUtf8(env->GetIsolate(),
+ ProfileGenerator::kIdleEntryName);
CheckChildrenNames(root, names);
const v8::CpuProfileNode* programNode =
- GetChild(root, ProfileGenerator::kProgramEntryName);
+ GetChild(env->GetIsolate(), root, ProfileGenerator::kProgramEntryName);
CHECK_EQ(0, programNode->GetChildrenCount());
CHECK_GE(programNode->GetHitCount(), 3);
const v8::CpuProfileNode* idleNode =
- GetChild(root, ProfileGenerator::kIdleEntryName);
+ GetChild(env->GetIsolate(), root, ProfileGenerator::kIdleEntryName);
CHECK_EQ(0, idleNode->GetChildrenCount());
CHECK_GE(idleNode->GetHitCount(), 3);
@@ -1393,11 +1471,14 @@
}
-static void CheckFunctionDetails(const v8::CpuProfileNode* node,
- const char* name, const char* script_name, int script_id,
- int line, int column) {
- CHECK_EQ(v8::String::New(name), node->GetFunctionName());
- CHECK_EQ(v8::String::New(script_name), node->GetScriptResourceName());
+static void CheckFunctionDetails(v8::Isolate* isolate,
+ const v8::CpuProfileNode* node,
+ const char* name, const char* script_name,
+ int script_id, int line, int column) {
+ CHECK_EQ(v8::String::NewFromUtf8(isolate, name),
+ node->GetFunctionName());
+ CHECK_EQ(v8::String::NewFromUtf8(isolate, script_name),
+ node->GetScriptResourceName());
CHECK_EQ(script_id, node->GetScriptId());
CHECK_EQ(line, node->GetLineNumber());
CHECK_EQ(column, node->GetColumnNumber());
@@ -1412,14 +1493,20 @@
v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler();
CHECK_EQ(0, profiler->GetProfileCount());
- v8::Handle<v8::Script> script_a = v8::Script::Compile(v8::String::New(
- " function foo\n() { try { bar(); } catch(e) {} }\n"
- " function bar() { startProfiling(); }\n"), v8::String::New("script_a"));
+ v8::Handle<v8::Script> script_a = v8::Script::Compile(
+ v8::String::NewFromUtf8(
+ env->GetIsolate(),
+ " function foo\n() { try { bar(); } catch(e) {} }\n"
+ " function bar() { startProfiling(); }\n"),
+ v8::String::NewFromUtf8(env->GetIsolate(), "script_a"));
script_a->Run();
- v8::Handle<v8::Script> script_b = v8::Script::Compile(v8::String::New(
- "\n\n function baz() { try { foo(); } catch(e) {} }\n"
- "\n\nbaz();\n"
- "stopProfiling();\n"), v8::String::New("script_b"));
+ v8::Handle<v8::Script> script_b = v8::Script::Compile(
+ v8::String::NewFromUtf8(
+ env->GetIsolate(),
+ "\n\n function baz() { try { foo(); } catch(e) {} }\n"
+ "\n\nbaz();\n"
+ "stopProfiling();\n"),
+ v8::String::NewFromUtf8(env->GetIsolate(), "script_b"));
script_b->Run();
CHECK_EQ(1, profiler->GetProfileCount());
const v8::CpuProfile* profile = profiler->GetCpuProfile(0);
@@ -1433,14 +1520,18 @@
// 0 foo 18 #4 TryCatchStatement script_a:2
// 1 bar 18 #5 no reason script_a:3
const v8::CpuProfileNode* root = profile->GetTopDownRoot();
- const v8::CpuProfileNode* script = GetChild(root,
+ const v8::CpuProfileNode* script = GetChild(env->GetIsolate(), root,
ProfileGenerator::kAnonymousFunctionName);
- CheckFunctionDetails(script, ProfileGenerator::kAnonymousFunctionName,
- "script_b", script_b->GetId(), 1, 1);
- const v8::CpuProfileNode* baz = GetChild(script, "baz");
- CheckFunctionDetails(baz, "baz", "script_b", script_b->GetId(), 3, 16);
- const v8::CpuProfileNode* foo = GetChild(baz, "foo");
- CheckFunctionDetails(foo, "foo", "script_a", script_a->GetId(), 2, 1);
- const v8::CpuProfileNode* bar = GetChild(foo, "bar");
- CheckFunctionDetails(bar, "bar", "script_a", script_a->GetId(), 3, 14);
+ CheckFunctionDetails(env->GetIsolate(), script,
+ ProfileGenerator::kAnonymousFunctionName, "script_b",
+ script_b->GetId(), 1, 1);
+ const v8::CpuProfileNode* baz = GetChild(env->GetIsolate(), script, "baz");
+ CheckFunctionDetails(env->GetIsolate(), baz, "baz", "script_b",
+ script_b->GetId(), 3, 16);
+ const v8::CpuProfileNode* foo = GetChild(env->GetIsolate(), baz, "foo");
+ CheckFunctionDetails(env->GetIsolate(), foo, "foo", "script_a",
+ script_a->GetId(), 2, 1);
+ const v8::CpuProfileNode* bar = GetChild(env->GetIsolate(), foo, "bar");
+ CheckFunctionDetails(env->GetIsolate(), bar, "bar", "script_a",
+ script_a->GetId(), 3, 14);
}
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 0c8a02b..eb9789a 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -154,6 +154,7 @@
inline v8::Local<v8::Context> context() { return context_; }
inline v8::Context* operator->() { return *context_; }
inline v8::Context* operator*() { return *context_; }
+ inline v8::Isolate* GetIsolate() { return context_->GetIsolate(); }
inline bool IsReady() { return !context_.IsEmpty(); }
void ExposeDebug() {
v8::internal::Isolate* isolate =
@@ -188,20 +189,22 @@
static v8::Local<v8::Function> CompileFunction(DebugLocalContext* env,
const char* source,
const char* function_name) {
- v8::Script::Compile(v8::String::New(source))->Run();
- return v8::Local<v8::Function>::Cast(
- (*env)->Global()->Get(v8::String::New(function_name)));
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), source))
+ ->Run();
+ return v8::Local<v8::Function>::Cast((*env)->Global()->Get(
+ v8::String::NewFromUtf8(env->GetIsolate(), function_name)));
}
// Compile and run the supplied source and return the requested function.
-static v8::Local<v8::Function> CompileFunction(const char* source,
+static v8::Local<v8::Function> CompileFunction(v8::Isolate* isolate,
+ const char* source,
const char* function_name) {
- v8::Script::Compile(v8::String::New(source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, source))->Run();
v8::Local<v8::Object> global =
CcTest::isolate()->GetCurrentContext()->Global();
return v8::Local<v8::Function>::Cast(
- global->Get(v8::String::New(function_name)));
+ global->Get(v8::String::NewFromUtf8(isolate, function_name)));
}
@@ -236,20 +239,22 @@
// Set a break point in a function using the Debug object and return the
// associated break point number.
-static int SetBreakPointFromJS(const char* function_name,
+static int SetBreakPointFromJS(v8::Isolate* isolate,
+ const char* function_name,
int line, int position) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
OS::SNPrintF(buffer,
"debug.Debug.setBreakPoint(%s,%d,%d)",
function_name, line, position);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Handle<v8::String> str = v8::String::New(buffer.start());
+ v8::Handle<v8::String> str = v8::String::NewFromUtf8(isolate, buffer.start());
return v8::Script::Compile(str)->Run()->Int32Value();
}
// Set a break point in a script identified by id using the global Debug object.
-static int SetScriptBreakPointByIdFromJS(int script_id, int line, int column) {
+static int SetScriptBreakPointByIdFromJS(v8::Isolate* isolate, int script_id,
+ int line, int column) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
if (column >= 0) {
// Column specified set script break point on precise location.
@@ -265,7 +270,8 @@
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
{
v8::TryCatch try_catch;
- v8::Handle<v8::String> str = v8::String::New(buffer.start());
+ v8::Handle<v8::String> str =
+ v8::String::NewFromUtf8(isolate, buffer.start());
v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run();
CHECK(!try_catch.HasCaught());
return value->Int32Value();
@@ -275,8 +281,9 @@
// Set a break point in a script identified by name using the global Debug
// object.
-static int SetScriptBreakPointByNameFromJS(const char* script_name,
- int line, int column) {
+static int SetScriptBreakPointByNameFromJS(v8::Isolate* isolate,
+ const char* script_name, int line,
+ int column) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
if (column >= 0) {
// Column specified set script break point on precise location.
@@ -292,7 +299,8 @@
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
{
v8::TryCatch try_catch;
- v8::Handle<v8::String> str = v8::String::New(buffer.start());
+ v8::Handle<v8::String> str =
+ v8::String::NewFromUtf8(isolate, buffer.start());
v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run();
CHECK(!try_catch.HasCaught());
return value->Int32Value();
@@ -310,55 +318,60 @@
// Clear a break point using the global Debug object.
-static void ClearBreakPointFromJS(int break_point_number) {
+static void ClearBreakPointFromJS(v8::Isolate* isolate,
+ int break_point_number) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
OS::SNPrintF(buffer,
"debug.Debug.clearBreakPoint(%d)",
break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer.start()))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
-static void EnableScriptBreakPointFromJS(int break_point_number) {
+static void EnableScriptBreakPointFromJS(v8::Isolate* isolate,
+ int break_point_number) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
OS::SNPrintF(buffer,
"debug.Debug.enableScriptBreakPoint(%d)",
break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer.start()))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
-static void DisableScriptBreakPointFromJS(int break_point_number) {
+static void DisableScriptBreakPointFromJS(v8::Isolate* isolate,
+ int break_point_number) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
OS::SNPrintF(buffer,
"debug.Debug.disableScriptBreakPoint(%d)",
break_point_number);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer.start()))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
-static void ChangeScriptBreakPointConditionFromJS(int break_point_number,
+static void ChangeScriptBreakPointConditionFromJS(v8::Isolate* isolate,
+ int break_point_number,
const char* condition) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
OS::SNPrintF(buffer,
"debug.Debug.changeScriptBreakPointCondition(%d, \"%s\")",
break_point_number, condition);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer.start()))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
-static void ChangeScriptBreakPointIgnoreCountFromJS(int break_point_number,
+static void ChangeScriptBreakPointIgnoreCountFromJS(v8::Isolate* isolate,
+ int break_point_number,
int ignoreCount) {
EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
OS::SNPrintF(buffer,
"debug.Debug.changeScriptBreakPointIgnoreCount(%d, %d)",
break_point_number, ignoreCount);
buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
- v8::Script::Compile(v8::String::New(buffer.start()))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, buffer.start()))->Run();
}
@@ -371,20 +384,25 @@
// Change break on exception using the global Debug object.
-static void ChangeBreakOnExceptionFromJS(bool caught, bool uncaught) {
+static void ChangeBreakOnExceptionFromJS(v8::Isolate* isolate, bool caught,
+ bool uncaught) {
if (caught) {
v8::Script::Compile(
- v8::String::New("debug.Debug.setBreakOnException()"))->Run();
+ v8::String::NewFromUtf8(isolate, "debug.Debug.setBreakOnException()"))
+ ->Run();
} else {
v8::Script::Compile(
- v8::String::New("debug.Debug.clearBreakOnException()"))->Run();
+ v8::String::NewFromUtf8(isolate, "debug.Debug.clearBreakOnException()"))
+ ->Run();
}
if (uncaught) {
v8::Script::Compile(
- v8::String::New("debug.Debug.setBreakOnUncaughtException()"))->Run();
+ v8::String::NewFromUtf8(
+ isolate, "debug.Debug.setBreakOnUncaughtException()"))->Run();
} else {
v8::Script::Compile(
- v8::String::New("debug.Debug.clearBreakOnUncaughtException()"))->Run();
+ v8::String::NewFromUtf8(
+ isolate, "debug.Debug.clearBreakOnUncaughtException()"))->Run();
}
}
@@ -799,7 +817,8 @@
exception_hit_count++;
// Check whether the exception was uncaught.
- v8::Local<v8::String> fun_name = v8::String::New("uncaught");
+ v8::Local<v8::String> fun_name =
+ v8::String::NewFromUtf8(CcTest::isolate(), "uncaught");
v8::Local<v8::Function> fun =
v8::Local<v8::Function>::Cast(event_data->Get(fun_name));
v8::Local<v8::Value> result = fun->Call(event_data, 0, NULL);
@@ -856,9 +875,10 @@
if (event == v8::Break) {
for (int i = 0; checks[i].expr != NULL; i++) {
const int argc = 3;
- v8::Handle<v8::Value> argv[argc] = { exec_state,
- v8::String::New(checks[i].expr),
- checks[i].expected };
+ v8::Handle<v8::Value> argv[argc] = {
+ exec_state,
+ v8::String::NewFromUtf8(CcTest::isolate(), checks[i].expr),
+ checks[i].expected};
v8::Handle<v8::Value> result =
evaluate_check_function->Call(exec_state, argc, argv);
if (!result->IsTrue()) {
@@ -1187,9 +1207,10 @@
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Script::Compile(v8::String::New("function foo(){bar=0;}"))->Run();
- v8::Local<v8::Function> foo =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "function foo(){bar=0;}"))->Run();
+ v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
// Run without breakpoints.
foo->Call(env->Global(), 0, NULL);
@@ -1218,10 +1239,13 @@
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Script::Compile(v8::String::New("bar=1"))->Run();
- v8::Script::Compile(v8::String::New("function foo(){var x=bar;}"))->Run();
- v8::Local<v8::Function> foo =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), "bar=1"))
+ ->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "function foo(){var x=bar;}"))
+ ->Run();
+ v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
// Run without breakpoints.
foo->Call(env->Global(), 0, NULL);
@@ -1250,10 +1274,12 @@
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Script::Compile(v8::String::New("function bar(){}"))->Run();
- v8::Script::Compile(v8::String::New("function foo(){bar();}"))->Run();
- v8::Local<v8::Function> foo =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "function bar(){}"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "function foo(){bar();}"))->Run();
+ v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
// Run without breakpoints.
foo->Call(env->Global(), 0, NULL);
@@ -1282,10 +1308,14 @@
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetDebugEventListener2(DebugEventBreakPointCollectGarbage);
- v8::Script::Compile(v8::String::New("function bar(){return 1;}"))->Run();
- v8::Script::Compile(v8::String::New("function foo(){return bar();}"))->Run();
- v8::Local<v8::Function> foo =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "function bar(){return 1;}"))
+ ->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "function foo(){return bar();}"))
+ ->Run();
+ v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
// Run without breakpoints.
CHECK_EQ(1, foo->Call(env->Global(), 0, NULL)->Int32Value());
@@ -1314,11 +1344,14 @@
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetDebugEventListener2(DebugEventBreakPointCollectGarbage);
- v8::Script::Compile(v8::String::New("function bar(){ this.x = 1;}"))->Run();
- v8::Script::Compile(v8::String::New(
- "function foo(){return new bar(1).x;}"))->Run();
- v8::Local<v8::Function> foo =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "function bar(){ this.x = 1;}"))
+ ->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ "function foo(){return new bar(1).x;}"))->Run();
+ v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
// Run without breakpoints.
CHECK_EQ(1, foo->Call(env->Global(), 0, NULL)->Int32Value());
@@ -1358,9 +1391,10 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Script::Compile(v8::String::New("function foo(){}"))->Run();
- v8::Local<v8::Function> foo =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "function foo(){}"))->Run();
+ v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
// Run without breakpoints.
foo->Call(env->Global(), 0, NULL);
@@ -1527,40 +1561,44 @@
env.ExposeDebug();
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Script::Compile(v8::String::New("function bar(){}"))->Run();
- v8::Script::Compile(v8::String::New("function foo(){bar();bar();}"))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "function bar(){}"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "function foo(){bar();bar();}"))
+ ->Run();
// 012345678901234567890
// 1 2
// Break points are set at position 3 and 9
- v8::Local<v8::Script> foo = v8::Script::Compile(v8::String::New("foo()"));
+ v8::Local<v8::Script> foo =
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), "foo()"));
// Run without breakpoints.
foo->Run();
CHECK_EQ(0, break_point_hit_count);
// Run with one breakpoint
- int bp1 = SetBreakPointFromJS("foo", 0, 3);
+ int bp1 = SetBreakPointFromJS(env->GetIsolate(), "foo", 0, 3);
foo->Run();
CHECK_EQ(1, break_point_hit_count);
foo->Run();
CHECK_EQ(2, break_point_hit_count);
// Run with two breakpoints
- int bp2 = SetBreakPointFromJS("foo", 0, 9);
+ int bp2 = SetBreakPointFromJS(env->GetIsolate(), "foo", 0, 9);
foo->Run();
CHECK_EQ(4, break_point_hit_count);
foo->Run();
CHECK_EQ(6, break_point_hit_count);
// Run with one breakpoint
- ClearBreakPointFromJS(bp2);
+ ClearBreakPointFromJS(env->GetIsolate(), bp2);
foo->Run();
CHECK_EQ(7, break_point_hit_count);
foo->Run();
CHECK_EQ(8, break_point_hit_count);
// Run without breakpoints.
- ClearBreakPointFromJS(bp1);
+ ClearBreakPointFromJS(env->GetIsolate(), bp1);
foo->Run();
CHECK_EQ(8, break_point_hit_count);
@@ -1583,7 +1621,8 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Local<v8::String> script = v8::String::New(
+ v8::Local<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(),
"function f() {\n"
" function h() {\n"
" a = 0; // line 2\n"
@@ -1604,12 +1643,12 @@
// Compile the script and get the two functions.
v8::ScriptOrigin origin =
- v8::ScriptOrigin(v8::String::New("test"));
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
v8::Script::Compile(script, &origin)->Run();
- v8::Local<v8::Function> f =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
- v8::Local<v8::Function> g =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g")));
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+ v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
// Call f and g without break points.
break_point_hit_count = 0;
@@ -1619,7 +1658,7 @@
CHECK_EQ(0, break_point_hit_count);
// Call f and g with break point on line 12.
- int sbp1 = SetScriptBreakPointByNameFromJS("test", 12, 0);
+ int sbp1 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 12, 0);
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
@@ -1628,14 +1667,14 @@
// Remove the break point again.
break_point_hit_count = 0;
- ClearBreakPointFromJS(sbp1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp1);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
g->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
// Call f and g with break point on line 2.
- int sbp2 = SetScriptBreakPointByNameFromJS("test", 2, 0);
+ int sbp2 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 2, 0);
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
@@ -1643,10 +1682,10 @@
CHECK_EQ(2, break_point_hit_count);
// Call f and g with break point on line 2, 4, 12, 14 and 15.
- int sbp3 = SetScriptBreakPointByNameFromJS("test", 4, 0);
- int sbp4 = SetScriptBreakPointByNameFromJS("test", 12, 0);
- int sbp5 = SetScriptBreakPointByNameFromJS("test", 14, 0);
- int sbp6 = SetScriptBreakPointByNameFromJS("test", 15, 0);
+ int sbp3 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 4, 0);
+ int sbp4 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 12, 0);
+ int sbp5 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 14, 0);
+ int sbp6 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 15, 0);
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
@@ -1655,11 +1694,11 @@
// Remove all the break points again.
break_point_hit_count = 0;
- ClearBreakPointFromJS(sbp2);
- ClearBreakPointFromJS(sbp3);
- ClearBreakPointFromJS(sbp4);
- ClearBreakPointFromJS(sbp5);
- ClearBreakPointFromJS(sbp6);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp2);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp3);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp4);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp5);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp6);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
g->Call(env->Global(), 0, NULL);
@@ -1686,7 +1725,8 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Local<v8::String> source = v8::String::New(
+ v8::Local<v8::String> source = v8::String::NewFromUtf8(
+ env->GetIsolate(),
"function f() {\n"
" function h() {\n"
" a = 0; // line 2\n"
@@ -1707,16 +1747,16 @@
// Compile the script and get the two functions.
v8::ScriptOrigin origin =
- v8::ScriptOrigin(v8::String::New("test"));
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
v8::Local<v8::Script> script = v8::Script::Compile(source, &origin);
script->Run();
- v8::Local<v8::Function> f =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
- v8::Local<v8::Function> g =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g")));
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+ v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
// Get the script id knowing that internally it is a 32 integer.
- uint32_t script_id = script->Id()->Uint32Value();
+ int script_id = script->GetId();
// Call f and g without break points.
break_point_hit_count = 0;
@@ -1726,7 +1766,7 @@
CHECK_EQ(0, break_point_hit_count);
// Call f and g with break point on line 12.
- int sbp1 = SetScriptBreakPointByIdFromJS(script_id, 12, 0);
+ int sbp1 = SetScriptBreakPointByIdFromJS(env->GetIsolate(), script_id, 12, 0);
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
@@ -1735,14 +1775,14 @@
// Remove the break point again.
break_point_hit_count = 0;
- ClearBreakPointFromJS(sbp1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp1);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
g->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
// Call f and g with break point on line 2.
- int sbp2 = SetScriptBreakPointByIdFromJS(script_id, 2, 0);
+ int sbp2 = SetScriptBreakPointByIdFromJS(env->GetIsolate(), script_id, 2, 0);
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
@@ -1750,10 +1790,10 @@
CHECK_EQ(2, break_point_hit_count);
// Call f and g with break point on line 2, 4, 12, 14 and 15.
- int sbp3 = SetScriptBreakPointByIdFromJS(script_id, 4, 0);
- int sbp4 = SetScriptBreakPointByIdFromJS(script_id, 12, 0);
- int sbp5 = SetScriptBreakPointByIdFromJS(script_id, 14, 0);
- int sbp6 = SetScriptBreakPointByIdFromJS(script_id, 15, 0);
+ int sbp3 = SetScriptBreakPointByIdFromJS(env->GetIsolate(), script_id, 4, 0);
+ int sbp4 = SetScriptBreakPointByIdFromJS(env->GetIsolate(), script_id, 12, 0);
+ int sbp5 = SetScriptBreakPointByIdFromJS(env->GetIsolate(), script_id, 14, 0);
+ int sbp6 = SetScriptBreakPointByIdFromJS(env->GetIsolate(), script_id, 15, 0);
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
@@ -1762,11 +1802,11 @@
// Remove all the break points again.
break_point_hit_count = 0;
- ClearBreakPointFromJS(sbp2);
- ClearBreakPointFromJS(sbp3);
- ClearBreakPointFromJS(sbp4);
- ClearBreakPointFromJS(sbp5);
- ClearBreakPointFromJS(sbp6);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp2);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp3);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp4);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp5);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp6);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
g->Call(env->Global(), 0, NULL);
@@ -1794,45 +1834,47 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Local<v8::String> script = v8::String::New(
+ v8::Local<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(),
"function f() {\n"
" a = 0; // line 1\n"
"};");
// Compile the script and get function f.
v8::ScriptOrigin origin =
- v8::ScriptOrigin(v8::String::New("test"));
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
v8::Script::Compile(script, &origin)->Run();
- v8::Local<v8::Function> f =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
// Set script break point on line 1 (in function f).
- int sbp = SetScriptBreakPointByNameFromJS("test", 1, 0);
+ int sbp = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 1, 0);
// Call f while enabeling and disabling the script break point.
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
- DisableScriptBreakPointFromJS(sbp);
+ DisableScriptBreakPointFromJS(env->GetIsolate(), sbp);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
- EnableScriptBreakPointFromJS(sbp);
+ EnableScriptBreakPointFromJS(env->GetIsolate(), sbp);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
- DisableScriptBreakPointFromJS(sbp);
+ DisableScriptBreakPointFromJS(env->GetIsolate(), sbp);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
// Reload the script and get f again checking that the disabeling survives.
v8::Script::Compile(script, &origin)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
- EnableScriptBreakPointFromJS(sbp);
+ EnableScriptBreakPointFromJS(env->GetIsolate(), sbp);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(3, break_point_hit_count);
@@ -1850,7 +1892,8 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Local<v8::String> script = v8::String::New(
+ v8::Local<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(),
"count = 0;\n"
"function f() {\n"
" g(count++); // line 2\n"
@@ -1861,26 +1904,26 @@
// Compile the script and get function f.
v8::ScriptOrigin origin =
- v8::ScriptOrigin(v8::String::New("test"));
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
v8::Script::Compile(script, &origin)->Run();
- v8::Local<v8::Function> f =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
// Set script break point on line 5 (in function g).
- int sbp1 = SetScriptBreakPointByNameFromJS("test", 5, 0);
+ int sbp1 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 5, 0);
// Call f with different conditions on the script break point.
break_point_hit_count = 0;
- ChangeScriptBreakPointConditionFromJS(sbp1, "false");
+ ChangeScriptBreakPointConditionFromJS(env->GetIsolate(), sbp1, "false");
f->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
- ChangeScriptBreakPointConditionFromJS(sbp1, "true");
+ ChangeScriptBreakPointConditionFromJS(env->GetIsolate(), sbp1, "true");
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
- ChangeScriptBreakPointConditionFromJS(sbp1, "x % 2 == 0");
+ ChangeScriptBreakPointConditionFromJS(env->GetIsolate(), sbp1, "x % 2 == 0");
break_point_hit_count = 0;
for (int i = 0; i < 10; i++) {
f->Call(env->Global(), 0, NULL);
@@ -1889,7 +1932,8 @@
// Reload the script and get f again checking that the condition survives.
v8::Script::Compile(script, &origin)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
break_point_hit_count = 0;
for (int i = 0; i < 10; i++) {
@@ -1911,30 +1955,31 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Local<v8::String> script = v8::String::New(
+ v8::Local<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(),
"function f() {\n"
" a = 0; // line 1\n"
"};");
// Compile the script and get function f.
v8::ScriptOrigin origin =
- v8::ScriptOrigin(v8::String::New("test"));
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
v8::Script::Compile(script, &origin)->Run();
- v8::Local<v8::Function> f =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
// Set script break point on line 1 (in function f).
- int sbp = SetScriptBreakPointByNameFromJS("test", 1, 0);
+ int sbp = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 1, 0);
// Call f with different ignores on the script break point.
break_point_hit_count = 0;
- ChangeScriptBreakPointIgnoreCountFromJS(sbp, 1);
+ ChangeScriptBreakPointIgnoreCountFromJS(env->GetIsolate(), sbp, 1);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
f->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
- ChangeScriptBreakPointIgnoreCountFromJS(sbp, 5);
+ ChangeScriptBreakPointIgnoreCountFromJS(env->GetIsolate(), sbp, 5);
break_point_hit_count = 0;
for (int i = 0; i < 10; i++) {
f->Call(env->Global(), 0, NULL);
@@ -1943,7 +1988,8 @@
// Reload the script and get f again checking that the ignore survives.
v8::Script::Compile(script, &origin)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
break_point_hit_count = 0;
for (int i = 0; i < 10; i++) {
@@ -1966,7 +2012,8 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
v8::Local<v8::Function> f;
- v8::Local<v8::String> script = v8::String::New(
+ v8::Local<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(),
"function f() {\n"
" function h() {\n"
" a = 0; // line 2\n"
@@ -1975,15 +2022,18 @@
" return h();\n"
"}");
- v8::ScriptOrigin origin_1 = v8::ScriptOrigin(v8::String::New("1"));
- v8::ScriptOrigin origin_2 = v8::ScriptOrigin(v8::String::New("2"));
+ v8::ScriptOrigin origin_1 =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "1"));
+ v8::ScriptOrigin origin_2 =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "2"));
// Set a script break point before the script is loaded.
- SetScriptBreakPointByNameFromJS("1", 2, 0);
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "1", 2, 0);
// Compile the script and get the function.
v8::Script::Compile(script, &origin_1)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
// Call f and check that the script break point is active.
break_point_hit_count = 0;
@@ -1993,7 +2043,8 @@
// Compile the script again with a different script data and get the
// function.
v8::Script::Compile(script, &origin_2)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
// Call f and check that no break points are set.
break_point_hit_count = 0;
@@ -2002,7 +2053,8 @@
// Compile the script again and get the function.
v8::Script::Compile(script, &origin_1)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
// Call f and check that the script break point is active.
break_point_hit_count = 0;
@@ -2024,28 +2076,32 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
v8::Local<v8::Function> f;
- v8::Local<v8::String> script_f = v8::String::New(
- "function f() {\n"
- " a = 0; // line 1\n"
- "}");
+ v8::Local<v8::String> script_f =
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ "function f() {\n"
+ " a = 0; // line 1\n"
+ "}");
v8::Local<v8::Function> g;
- v8::Local<v8::String> script_g = v8::String::New(
- "function g() {\n"
- " b = 0; // line 1\n"
- "}");
+ v8::Local<v8::String> script_g =
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ "function g() {\n"
+ " b = 0; // line 1\n"
+ "}");
v8::ScriptOrigin origin =
- v8::ScriptOrigin(v8::String::New("test"));
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "test"));
// Set a script break point before the scripts are loaded.
- int sbp = SetScriptBreakPointByNameFromJS("test", 1, 0);
+ int sbp = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 1, 0);
// Compile the scripts with same script data and get the functions.
v8::Script::Compile(script_f, &origin)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
v8::Script::Compile(script_g, &origin)->Run();
- g = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g")));
+ g = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
// Call f and g and check that the script break point is active.
break_point_hit_count = 0;
@@ -2055,7 +2111,7 @@
CHECK_EQ(2, break_point_hit_count);
// Clear the script break point.
- ClearBreakPointFromJS(sbp);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp);
// Call f and g and check that the script break point is no longer active.
break_point_hit_count = 0;
@@ -2065,7 +2121,7 @@
CHECK_EQ(0, break_point_hit_count);
// Set script break point with the scripts loaded.
- sbp = SetScriptBreakPointByNameFromJS("test", 1, 0);
+ sbp = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test", 1, 0);
// Call f and g and check that the script break point is active.
break_point_hit_count = 0;
@@ -2089,23 +2145,28 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
v8::Local<v8::Function> f;
- v8::Local<v8::String> script = v8::String::New(
- "function f() {\n"
- " a = 0; // line 8 as this script has line offset 7\n"
- " b = 0; // line 9 as this script has line offset 7\n"
- "}");
+ v8::Local<v8::String> script = v8::String::NewFromUtf8(
+ env->GetIsolate(),
+ "function f() {\n"
+ " a = 0; // line 8 as this script has line offset 7\n"
+ " b = 0; // line 9 as this script has line offset 7\n"
+ "}");
// Create script origin both name and line offset.
- v8::ScriptOrigin origin(v8::String::New("test.html"),
- v8::Integer::New(7));
+ v8::ScriptOrigin origin(
+ v8::String::NewFromUtf8(env->GetIsolate(), "test.html"),
+ v8::Integer::New(7));
// Set two script break points before the script is loaded.
- int sbp1 = SetScriptBreakPointByNameFromJS("test.html", 8, 0);
- int sbp2 = SetScriptBreakPointByNameFromJS("test.html", 9, 0);
+ int sbp1 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 8, 0);
+ int sbp2 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 9, 0);
// Compile the script and get the function.
v8::Script::Compile(script, &origin)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
// Call f and check that the script break point is active.
break_point_hit_count = 0;
@@ -2113,8 +2174,8 @@
CHECK_EQ(2, break_point_hit_count);
// Clear the script break points.
- ClearBreakPointFromJS(sbp1);
- ClearBreakPointFromJS(sbp2);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp2);
// Call f and check that no script break points are active.
break_point_hit_count = 0;
@@ -2122,7 +2183,7 @@
CHECK_EQ(0, break_point_hit_count);
// Set a script break point with the script loaded.
- sbp1 = SetScriptBreakPointByNameFromJS("test.html", 9, 0);
+ sbp1 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 9, 0);
// Call f and check that the script break point is active.
break_point_hit_count = 0;
@@ -2149,32 +2210,40 @@
v8::Local<v8::Function> f;
v8::Local<v8::Function> g;
- v8::Local<v8::String> script = v8::String::New(
- "a = 0 // line 0\n"
- "function f() {\n"
- " a = 1; // line 2\n"
- "}\n"
- " a = 2; // line 4\n"
- " /* xx */ function g() { // line 5\n"
- " function h() { // line 6\n"
- " a = 3; // line 7\n"
- " }\n"
- " h(); // line 9\n"
- " a = 4; // line 10\n"
- " }\n"
- " a=5; // line 12");
+ v8::Local<v8::String> script =
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ "a = 0 // line 0\n"
+ "function f() {\n"
+ " a = 1; // line 2\n"
+ "}\n"
+ " a = 2; // line 4\n"
+ " /* xx */ function g() { // line 5\n"
+ " function h() { // line 6\n"
+ " a = 3; // line 7\n"
+ " }\n"
+ " h(); // line 9\n"
+ " a = 4; // line 10\n"
+ " }\n"
+ " a=5; // line 12");
// Set a couple script break point before the script is loaded.
- int sbp1 = SetScriptBreakPointByNameFromJS("test.html", 0, -1);
- int sbp2 = SetScriptBreakPointByNameFromJS("test.html", 1, -1);
- int sbp3 = SetScriptBreakPointByNameFromJS("test.html", 5, -1);
+ int sbp1 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 0, -1);
+ int sbp2 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 1, -1);
+ int sbp3 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 5, -1);
// Compile the script and get the function.
break_point_hit_count = 0;
- v8::ScriptOrigin origin(v8::String::New("test.html"), v8::Integer::New(0));
+ v8::ScriptOrigin origin(
+ v8::String::NewFromUtf8(env->GetIsolate(), "test.html"),
+ v8::Integer::New(0));
v8::Script::Compile(script, &origin)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
- g = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+ g = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
// Check that a break point was hit when the script was run.
CHECK_EQ(1, break_point_hit_count);
@@ -2191,8 +2260,9 @@
CHECK_EQ("g", last_function_hit);
// Clear the script break point on g and set one on h.
- ClearBreakPointFromJS(sbp3);
- int sbp4 = SetScriptBreakPointByNameFromJS("test.html", 6, -1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp3);
+ int sbp4 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 6, -1);
// Call g and check that the script break point in h is hit.
g->Call(env->Global(), 0, NULL);
@@ -2202,9 +2272,10 @@
// Clear break points in f and h. Set a new one in the script between
// functions f and g and test that there is no break points in f and g any
// more.
- ClearBreakPointFromJS(sbp2);
- ClearBreakPointFromJS(sbp4);
- int sbp5 = SetScriptBreakPointByNameFromJS("test.html", 4, -1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp2);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp4);
+ int sbp5 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 4, -1);
break_point_hit_count = 0;
f->Call(env->Global(), 0, NULL);
g->Call(env->Global(), 0, NULL);
@@ -2217,7 +2288,8 @@
CHECK_EQ(0, StrLength(last_function_hit));
// Set a break point in the code after the last function decleration.
- int sbp6 = SetScriptBreakPointByNameFromJS("test.html", 12, -1);
+ int sbp6 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 12, -1);
// Reload the script which should hit three break points.
break_point_hit_count = 0;
@@ -2227,9 +2299,9 @@
// Clear the last break points, and reload the script which should not hit any
// break points.
- ClearBreakPointFromJS(sbp1);
- ClearBreakPointFromJS(sbp5);
- ClearBreakPointFromJS(sbp6);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp5);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp6);
break_point_hit_count = 0;
v8::Script::Compile(script, &origin)->Run();
CHECK_EQ(0, break_point_hit_count);
@@ -2247,21 +2319,24 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Local<v8::String> script = v8::String::New(
- "function f() {\n"
- " a = 1; // line 1\n"
- "}\n"
- "a = 2; // line 3\n");
+ v8::Local<v8::String> script =
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ "function f() {\n"
+ " a = 1; // line 1\n"
+ "}\n"
+ "a = 2; // line 3\n");
v8::Local<v8::Function> f;
{
v8::HandleScope scope(env->GetIsolate());
- v8::Script::Compile(script, v8::String::New("test.html"))->Run();
+ v8::Script::Compile(
+ script, v8::String::NewFromUtf8(env->GetIsolate(), "test.html"))->Run();
}
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
- SetScriptBreakPointByNameFromJS("test.html", 3, -1);
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 3, -1);
// Call f and check that there was no break points.
break_point_hit_count = 0;
@@ -2270,12 +2345,14 @@
// Recompile and run script and check that break point was hit.
break_point_hit_count = 0;
- v8::Script::Compile(script, v8::String::New("test.html"))->Run();
+ v8::Script::Compile(
+ script, v8::String::NewFromUtf8(env->GetIsolate(), "test.html"))->Run();
CHECK_EQ(1, break_point_hit_count);
// Call f and check that there are still no break points.
break_point_hit_count = 0;
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
CHECK_EQ(0, break_point_hit_count);
v8::Debug::SetDebugEventListener2(NULL);
@@ -2292,23 +2369,28 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Local<v8::String> script_source = v8::String::New(
- "function f() {\n"
- " return 0;\n"
- "}\n"
- "f()");
+ v8::Local<v8::String> script_source =
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ "function f() {\n"
+ " return 0;\n"
+ "}\n"
+ "f()");
- int sbp1 = SetScriptBreakPointByNameFromJS("test.html", 3, -1);
+ int sbp1 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 3, -1);
{
v8::HandleScope scope(env->GetIsolate());
break_point_hit_count = 0;
- v8::Script::Compile(script_source, v8::String::New("test.html"))->Run();
+ v8::Script::Compile(script_source,
+ v8::String::NewFromUtf8(env->GetIsolate(), "test.html"))
+ ->Run();
CHECK_EQ(1, break_point_hit_count);
}
- int sbp2 = SetScriptBreakPointByNameFromJS("test.html", 3, -1);
- ClearBreakPointFromJS(sbp1);
- ClearBreakPointFromJS(sbp2);
+ int sbp2 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 3, -1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp2);
v8::Debug::SetDebugEventListener2(NULL);
CheckDebuggerUnloaded();
@@ -2347,13 +2429,16 @@
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Script::Compile(v8::String::New("function bar(){debugger}"))->Run();
- v8::Script::Compile(v8::String::New(
- "function foo(){debugger;debugger;}"))->Run();
- v8::Local<v8::Function> foo =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
- v8::Local<v8::Function> bar =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("bar")));
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "function bar(){debugger}"))
+ ->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(),
+ "function foo(){debugger;debugger;}"))->Run();
+ v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
+ v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "bar")));
// Run function with debugger statement
bar->Call(env->Global(), 0, NULL);
@@ -2374,9 +2459,11 @@
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
- v8::Script::Compile(v8::String::New("function foo(){debugger;}"))->Run();
- v8::Local<v8::Function> foo =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("foo")));
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "function foo(){debugger;}"))
+ ->Run();
+ v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo")));
// The debugger statement triggers breakpint hit
foo->Call(env->Global(), 0, NULL);
@@ -2417,13 +2504,13 @@
{NULL, v8::Handle<v8::Value>()}
};
struct EvaluateCheck checks_hu[] = {
- {"x", v8::String::New("Hello, world!")},
+ {"x", v8::String::NewFromUtf8(env->GetIsolate(), "Hello, world!")},
{"a", v8::Undefined(isolate)},
{NULL, v8::Handle<v8::Value>()}
};
struct EvaluateCheck checks_hh[] = {
- {"x", v8::String::New("Hello, world!")},
- {"a", v8::String::New("Hello, world!")},
+ {"x", v8::String::NewFromUtf8(env->GetIsolate(), "Hello, world!")},
+ {"a", v8::String::NewFromUtf8(env->GetIsolate(), "Hello, world!")},
{NULL, v8::Handle<v8::Value>()}
};
@@ -2443,7 +2530,8 @@
const int foo_break_position_2 = 29;
// Arguments with one parameter "Hello, world!"
- v8::Handle<v8::Value> argv_foo[1] = { v8::String::New("Hello, world!") };
+ v8::Handle<v8::Value> argv_foo[1] = {
+ v8::String::NewFromUtf8(env->GetIsolate(), "Hello, world!")};
// Call foo with breakpoint set before a=x and undefined as parameter.
int bp = SetBreakPoint(foo, foo_break_position_1);
@@ -2493,7 +2581,7 @@
// "Hello, world!".
checks = checks_hu;
v8::Handle<v8::Value> argv_bar_2[2] = {
- v8::String::New("Hello, world!"),
+ v8::String::NewFromUtf8(env->GetIsolate(), "Hello, world!"),
v8::Number::New(barbar_break_position)
};
bar->Call(env->Global(), 2, argv_bar_2);
@@ -2502,7 +2590,7 @@
// "Hello, world!".
checks = checks_hh;
v8::Handle<v8::Value> argv_bar_3[2] = {
- v8::String::New("Hello, world!"),
+ v8::String::NewFromUtf8(env->GetIsolate(), "Hello, world!"),
v8::Number::New(barbar_break_position + 1)
};
bar->Call(env->Global(), 2, argv_bar_3);
@@ -2690,10 +2778,10 @@
static void DebugProcessDebugMessagesHandler(
const v8::Debug::Message& message) {
v8::Handle<v8::String> json = message.GetJSON();
- v8::String::AsciiValue ascii(json);
+ v8::String::Utf8Value utf8(json);
EvaluateResult* array_item = process_debug_messages_data.current();
- bool res = GetEvaluateStringResult(*ascii,
+ bool res = GetEvaluateStringResult(*utf8,
array_item->buffer,
EvaluateResult::kBufferSize);
if (res) {
@@ -2713,7 +2801,8 @@
const char* source =
"var v1 = 'Pinguin';\n function getAnimal() { return 'Capy' + 'bara'; }";
- v8::Script::Compile(v8::String::New(source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), source))
+ ->Run();
v8::Debug::ProcessDebugMessages();
@@ -3489,7 +3578,8 @@
" with (b) {}"
"}"
"foo()";
- env->Global()->Set(v8::String::New("b"), v8::Object::New());
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "b"),
+ v8::Object::New());
v8::Local<v8::Function> foo = CompileFunction(&env, src, "foo");
v8::Handle<v8::Value> result;
SetBreakPoint(foo, 8); // "var a = {};"
@@ -3823,12 +3913,14 @@
const char* script_name = "StepInHandlerTest";
// Set breakpoint in the script.
- SetScriptBreakPointByNameFromJS(script_name, 0, -1);
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), script_name, 0, -1);
break_point_hit_count = 0;
- v8::ScriptOrigin origin(v8::String::New(script_name), v8::Integer::New(0));
- v8::Handle<v8::Script> script = v8::Script::Compile(v8::String::New(src),
- &origin);
+ v8::ScriptOrigin origin(
+ v8::String::NewFromUtf8(env->GetIsolate(), script_name),
+ v8::Integer::New(0));
+ v8::Handle<v8::Script> script = v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), src), &origin);
v8::Local<v8::Value> r = script->Run();
CHECK(r->IsFunction());
@@ -3932,7 +4024,7 @@
// No break on exception using JavaScript
DebugEventCounterClear();
MessageCallbackCountClear();
- ChangeBreakOnExceptionFromJS(false, false);
+ ChangeBreakOnExceptionFromJS(env->GetIsolate(), false, false);
caught->Call(env->Global(), 0, NULL);
CHECK_EQ(0, exception_hit_count);
CHECK_EQ(0, uncaught_exception_hit_count);
@@ -3945,7 +4037,7 @@
// Break on uncaught exception using JavaScript
DebugEventCounterClear();
MessageCallbackCountClear();
- ChangeBreakOnExceptionFromJS(false, true);
+ ChangeBreakOnExceptionFromJS(env->GetIsolate(), false, true);
caught->Call(env->Global(), 0, NULL);
CHECK_EQ(0, exception_hit_count);
CHECK_EQ(0, uncaught_exception_hit_count);
@@ -3958,7 +4050,7 @@
// Break on exception and uncaught exception using JavaScript
DebugEventCounterClear();
MessageCallbackCountClear();
- ChangeBreakOnExceptionFromJS(true, true);
+ ChangeBreakOnExceptionFromJS(env->GetIsolate(), true, true);
caught->Call(env->Global(), 0, NULL);
CHECK_EQ(1, exception_hit_count);
CHECK_EQ(0, message_callback_count);
@@ -3971,7 +4063,7 @@
// Break on exception using JavaScript
DebugEventCounterClear();
MessageCallbackCountClear();
- ChangeBreakOnExceptionFromJS(true, false);
+ ChangeBreakOnExceptionFromJS(env->GetIsolate(), true, false);
caught->Call(env->Global(), 0, NULL);
CHECK_EQ(1, exception_hit_count);
CHECK_EQ(0, uncaught_exception_hit_count);
@@ -4015,28 +4107,30 @@
CHECK_EQ(-1, last_js_stack_height);
// Throws SyntaxError: Unexpected end of input
- v8::Script::Compile(v8::String::New("+++"));
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), "+++"));
CHECK_EQ(1, exception_hit_count);
CHECK_EQ(1, uncaught_exception_hit_count);
CHECK_EQ(1, message_callback_count);
CHECK_EQ(0, last_js_stack_height); // No JavaScript stack.
// Throws SyntaxError: Unexpected identifier
- v8::Script::Compile(v8::String::New("x x"));
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), "x x"));
CHECK_EQ(2, exception_hit_count);
CHECK_EQ(2, uncaught_exception_hit_count);
CHECK_EQ(2, message_callback_count);
CHECK_EQ(0, last_js_stack_height); // No JavaScript stack.
// Throws SyntaxError: Unexpected end of input
- v8::Script::Compile(v8::String::New("eval('+++')"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), "eval('+++')"))
+ ->Run();
CHECK_EQ(3, exception_hit_count);
CHECK_EQ(3, uncaught_exception_hit_count);
CHECK_EQ(3, message_callback_count);
CHECK_EQ(1, last_js_stack_height);
// Throws SyntaxError: Unexpected identifier
- v8::Script::Compile(v8::String::New("eval('x x')"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), "eval('x x')"))
+ ->Run();
CHECK_EQ(4, exception_hit_count);
CHECK_EQ(4, uncaught_exception_hit_count);
CHECK_EQ(4, message_callback_count);
@@ -4263,9 +4357,12 @@
static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
v8::Handle<v8::Array> result = v8::Array::New(3);
- result->Set(v8::Integer::New(0), v8::String::New("a"));
- result->Set(v8::Integer::New(1), v8::String::New("b"));
- result->Set(v8::Integer::New(2), v8::String::New("c"));
+ result->Set(v8::Integer::New(0),
+ v8::String::NewFromUtf8(info.GetIsolate(), "a"));
+ result->Set(v8::Integer::New(1),
+ v8::String::NewFromUtf8(info.GetIsolate(), "b"));
+ result->Set(v8::Integer::New(2),
+ v8::String::NewFromUtf8(info.GetIsolate(), "c"));
info.GetReturnValue().Set(result);
}
@@ -4282,13 +4379,13 @@
const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::String::Utf8Value n(name);
if (strcmp(*n, "a") == 0) {
- info.GetReturnValue().Set(v8::String::New("AA"));
+ info.GetReturnValue().Set(v8::String::NewFromUtf8(info.GetIsolate(), "AA"));
return;
} else if (strcmp(*n, "b") == 0) {
- info.GetReturnValue().Set(v8::String::New("BB"));
+ info.GetReturnValue().Set(v8::String::NewFromUtf8(info.GetIsolate(), "BB"));
return;
} else if (strcmp(*n, "c") == 0) {
- info.GetReturnValue().Set(v8::String::New("CC"));
+ info.GetReturnValue().Set(v8::String::NewFromUtf8(info.GetIsolate(), "CC"));
return;
} else {
info.GetReturnValue().SetUndefined();
@@ -4313,8 +4410,9 @@
// Create object with named interceptor.
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New();
named->SetNamedPropertyHandler(NamedGetter, NULL, NULL, NULL, NamedEnum);
- env->Global()->Set(v8::String::New("intercepted_named"),
- named->NewInstance());
+ env->Global()->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "intercepted_named"),
+ named->NewInstance());
// Create object with indexed interceptor.
v8::Handle<v8::ObjectTemplate> indexed = v8::ObjectTemplate::New();
@@ -4323,14 +4421,17 @@
NULL,
NULL,
IndexedEnum);
- env->Global()->Set(v8::String::New("intercepted_indexed"),
- indexed->NewInstance());
+ env->Global()->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "intercepted_indexed"),
+ indexed->NewInstance());
// Create object with both named and indexed interceptor.
v8::Handle<v8::ObjectTemplate> both = v8::ObjectTemplate::New();
both->SetNamedPropertyHandler(NamedGetter, NULL, NULL, NULL, NamedEnum);
both->SetIndexedPropertyHandler(IndexedGetter, NULL, NULL, NULL, IndexedEnum);
- env->Global()->Set(v8::String::New("intercepted_both"), both->NewInstance());
+ env->Global()->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "intercepted_both"),
+ both->NewInstance());
// Get mirrors for the three objects with interceptor.
CompileRun(
@@ -4442,25 +4543,29 @@
env.ExposeDebug();
v8::Handle<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New();
- t0->InstanceTemplate()->Set(v8::String::New("x"), v8::Number::New(0));
+ t0->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "x"),
+ v8::Number::New(0));
v8::Handle<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New();
t1->SetHiddenPrototype(true);
- t1->InstanceTemplate()->Set(v8::String::New("y"), v8::Number::New(1));
+ t1->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "y"),
+ v8::Number::New(1));
v8::Handle<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New();
t2->SetHiddenPrototype(true);
- t2->InstanceTemplate()->Set(v8::String::New("z"), v8::Number::New(2));
+ t2->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "z"),
+ v8::Number::New(2));
v8::Handle<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New();
- t3->InstanceTemplate()->Set(v8::String::New("u"), v8::Number::New(3));
+ t3->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "u"),
+ v8::Number::New(3));
// Create object and set them on the global object.
v8::Handle<v8::Object> o0 = t0->GetFunction()->NewInstance();
- env->Global()->Set(v8::String::New("o0"), o0);
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "o0"), o0);
v8::Handle<v8::Object> o1 = t1->GetFunction()->NewInstance();
- env->Global()->Set(v8::String::New("o1"), o1);
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "o1"), o1);
v8::Handle<v8::Object> o2 = t2->GetFunction()->NewInstance();
- env->Global()->Set(v8::String::New("o2"), o2);
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "o2"), o2);
v8::Handle<v8::Object> o3 = t3->GetFunction()->NewInstance();
- env->Global()->Set(v8::String::New("o3"), o3);
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "o3"), o3);
// Get mirrors for the four objects.
CompileRun(
@@ -4485,7 +4590,7 @@
// Set o1 as prototype for o0. o1 has the hidden prototype flag so all
// properties on o1 should be seen on o0.
- o0->Set(v8::String::New("__proto__"), o1);
+ o0->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), o1);
CHECK_EQ(2, CompileRun(
"o0_mirror.propertyNames().length")->Int32Value());
CHECK_EQ(0, CompileRun(
@@ -4496,7 +4601,7 @@
// Set o2 as prototype for o0 (it will end up after o1 as o1 has the hidden
// prototype flag. o2 also has the hidden prototype flag so all properties
// on o2 should be seen on o0 as well as properties on o1.
- o0->Set(v8::String::New("__proto__"), o2);
+ o0->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), o2);
CHECK_EQ(3, CompileRun(
"o0_mirror.propertyNames().length")->Int32Value());
CHECK_EQ(0, CompileRun(
@@ -4512,7 +4617,7 @@
// from o1 and o2 should still be seen on o0.
// Final prototype chain: o0 -> o1 -> o2 -> o3
// Hidden prototypes: ^^ ^^
- o0->Set(v8::String::New("__proto__"), o3);
+ o0->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), o3);
CHECK_EQ(3, CompileRun(
"o0_mirror.propertyNames().length")->Int32Value());
CHECK_EQ(1, CompileRun(
@@ -4543,14 +4648,15 @@
v8::HandleScope scope(env->GetIsolate());
env.ExposeDebug();
- v8::Handle<v8::String> name = v8::String::New("x");
+ v8::Handle<v8::String> name = v8::String::NewFromUtf8(env->GetIsolate(), "x");
// Create object with named accessor.
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New();
named->SetAccessor(name, &ProtperyXNativeGetter, NULL,
v8::Handle<v8::Value>(), v8::DEFAULT, v8::None);
// Create object with named property getter.
- env->Global()->Set(v8::String::New("instance"), named->NewInstance());
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "instance"),
+ named->NewInstance());
CHECK_EQ(10, CompileRun("instance.x")->Int32Value());
// Get mirror for the object with property getter.
@@ -4581,14 +4687,15 @@
v8::HandleScope scope(env->GetIsolate());
env.ExposeDebug();
- v8::Handle<v8::String> name = v8::String::New("x");
+ v8::Handle<v8::String> name = v8::String::NewFromUtf8(env->GetIsolate(), "x");
// Create object with named accessor.
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New();
named->SetAccessor(name, &ProtperyXNativeGetterThrowingError, NULL,
v8::Handle<v8::Value>(), v8::DEFAULT, v8::None);
// Create object with named property getter.
- env->Global()->Set(v8::String::New("instance"), named->NewInstance());
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "instance"),
+ named->NewInstance());
// Get mirror for the object with property getter.
CompileRun("var instance_mirror = debug.MakeMirror(instance);");
@@ -4618,12 +4725,14 @@
// Create an object in the global scope.
const char* source = "var obj = {a: 1};";
- v8::Script::Compile(v8::String::New(source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), source))
+ ->Run();
v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(
- env->Global()->Get(v8::String::New("obj")));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "obj")));
// Set a hidden property on the object.
- obj->SetHiddenValue(v8::String::New("v8::test-debug::a"),
- v8::Int32::New(11));
+ obj->SetHiddenValue(
+ v8::String::NewFromUtf8(env->GetIsolate(), "v8::test-debug::a"),
+ v8::Int32::New(11));
// Get mirror for the object with property getter.
CompileRun("var obj_mirror = debug.MakeMirror(obj);");
@@ -4640,25 +4749,33 @@
// Object created by t0 will become hidden prototype of object 'obj'.
v8::Handle<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New();
- t0->InstanceTemplate()->Set(v8::String::New("b"), v8::Number::New(2));
+ t0->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "b"),
+ v8::Number::New(2));
t0->SetHiddenPrototype(true);
v8::Handle<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New();
- t1->InstanceTemplate()->Set(v8::String::New("c"), v8::Number::New(3));
+ t1->InstanceTemplate()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "c"),
+ v8::Number::New(3));
// Create proto objects, add hidden properties to them and set them on
// the global object.
v8::Handle<v8::Object> protoObj = t0->GetFunction()->NewInstance();
- protoObj->SetHiddenValue(v8::String::New("v8::test-debug::b"),
- v8::Int32::New(12));
- env->Global()->Set(v8::String::New("protoObj"), protoObj);
+ protoObj->SetHiddenValue(
+ v8::String::NewFromUtf8(env->GetIsolate(), "v8::test-debug::b"),
+ v8::Int32::New(12));
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "protoObj"),
+ protoObj);
v8::Handle<v8::Object> grandProtoObj = t1->GetFunction()->NewInstance();
- grandProtoObj->SetHiddenValue(v8::String::New("v8::test-debug::c"),
- v8::Int32::New(13));
- env->Global()->Set(v8::String::New("grandProtoObj"), grandProtoObj);
+ grandProtoObj->SetHiddenValue(
+ v8::String::NewFromUtf8(env->GetIsolate(), "v8::test-debug::c"),
+ v8::Int32::New(13));
+ env->Global()->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "grandProtoObj"),
+ grandProtoObj);
// Setting prototypes: obj->protoObj->grandProtoObj
- protoObj->Set(v8::String::New("__proto__"), grandProtoObj);
- obj->Set(v8::String::New("__proto__"), protoObj);
+ protoObj->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"),
+ grandProtoObj);
+ obj->Set(v8::String::NewFromUtf8(env->GetIsolate(), "__proto__"), protoObj);
// Get mirror for the object with property getter.
CompileRun("var obj_mirror = debug.MakeMirror(obj);");
@@ -4844,8 +4961,8 @@
static void MessageHandler(const v8::Debug::Message& message) {
v8::Handle<v8::String> json = message.GetJSON();
- v8::String::AsciiValue ascii(json);
- if (IsBreakEventMessage(*ascii)) {
+ v8::String::Utf8Value utf8(json);
+ if (IsBreakEventMessage(*utf8)) {
// Lets test script wait until break occurs to send commands.
// Signals when a break is reported.
message_queue_barriers.semaphore_2.Signal();
@@ -5151,8 +5268,9 @@
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetMessageHandler2(&ThreadedMessageHandler);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
- global_template->Set(v8::String::New("ThreadedAtBarrier1"),
- v8::FunctionTemplate::New(ThreadedAtBarrier1));
+ global_template->Set(
+ v8::String::NewFromUtf8(env->GetIsolate(), "ThreadedAtBarrier1"),
+ v8::FunctionTemplate::New(ThreadedAtBarrier1));
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
NULL,
global_template);
@@ -5484,7 +5602,8 @@
// can throw exceptions.
static void CheckDataParameter(
const v8::FunctionCallbackInfo<v8::Value>& args) {
- v8::Handle<v8::String> data = v8::String::New("Test");
+ v8::Handle<v8::String> data =
+ v8::String::NewFromUtf8(args.GetIsolate(), "Test");
CHECK(v8::Debug::Call(debugger_call_with_data, data)->IsString());
CHECK(v8::Debug::Call(debugger_call_with_data).IsEmpty());
@@ -5510,73 +5629,92 @@
// CheckSourceLine and CheckDataParameter installed.
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
- global_template->Set(v8::String::New("CheckFrameCount"),
- v8::FunctionTemplate::New(CheckFrameCount));
- global_template->Set(v8::String::New("CheckSourceLine"),
- v8::FunctionTemplate::New(CheckSourceLine));
- global_template->Set(v8::String::New("CheckDataParameter"),
- v8::FunctionTemplate::New(CheckDataParameter));
- global_template->Set(v8::String::New("CheckClosure"),
- v8::FunctionTemplate::New(CheckClosure));
+ global_template->Set(
+ v8::String::NewFromUtf8(CcTest::isolate(), "CheckFrameCount"),
+ v8::FunctionTemplate::New(CheckFrameCount));
+ global_template->Set(
+ v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine"),
+ v8::FunctionTemplate::New(CheckSourceLine));
+ global_template->Set(
+ v8::String::NewFromUtf8(CcTest::isolate(), "CheckDataParameter"),
+ v8::FunctionTemplate::New(CheckDataParameter));
+ global_template->Set(
+ v8::String::NewFromUtf8(CcTest::isolate(), "CheckClosure"),
+ v8::FunctionTemplate::New(CheckClosure));
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
NULL,
global_template);
v8::Context::Scope context_scope(context);
// Compile a function for checking the number of JavaScript frames.
- v8::Script::Compile(v8::String::New(frame_count_source))->Run();
- frame_count = v8::Local<v8::Function>::Cast(
- context->Global()->Get(v8::String::New("frame_count")));
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(), frame_count_source))->Run();
+ frame_count = v8::Local<v8::Function>::Cast(context->Global()->Get(
+ v8::String::NewFromUtf8(CcTest::isolate(), "frame_count")));
// Compile a function for returning the source line for the top frame.
- v8::Script::Compile(v8::String::New(frame_source_line_source))->Run();
- frame_source_line = v8::Local<v8::Function>::Cast(
- context->Global()->Get(v8::String::New("frame_source_line")));
+ v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
+ frame_source_line_source))->Run();
+ frame_source_line = v8::Local<v8::Function>::Cast(context->Global()->Get(
+ v8::String::NewFromUtf8(CcTest::isolate(), "frame_source_line")));
// Compile a function returning the data parameter.
- v8::Script::Compile(v8::String::New(debugger_call_with_data_source))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
+ debugger_call_with_data_source))
+ ->Run();
debugger_call_with_data = v8::Local<v8::Function>::Cast(
- context->Global()->Get(v8::String::New("debugger_call_with_data")));
+ context->Global()->Get(v8::String::NewFromUtf8(
+ CcTest::isolate(), "debugger_call_with_data")));
// Compile a function capturing closure.
- debugger_call_with_closure = v8::Local<v8::Function>::Cast(
- v8::Script::Compile(
- v8::String::New(debugger_call_with_closure_source))->Run());
+ debugger_call_with_closure =
+ v8::Local<v8::Function>::Cast(v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(),
+ debugger_call_with_closure_source))->Run());
// Calling a function through the debugger returns 0 frames if there are
// no JavaScript frames.
CHECK_EQ(v8::Integer::New(0), v8::Debug::Call(frame_count));
// Test that the number of frames can be retrieved.
- v8::Script::Compile(v8::String::New("CheckFrameCount(1)"))->Run();
- v8::Script::Compile(v8::String::New("function f() {"
- " CheckFrameCount(2);"
- "}; f()"))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(), "CheckFrameCount(1)"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
+ "function f() {"
+ " CheckFrameCount(2);"
+ "}; f()"))->Run();
// Test that the source line can be retrieved.
- v8::Script::Compile(v8::String::New("CheckSourceLine(0)"))->Run();
- v8::Script::Compile(v8::String::New("function f() {\n"
- " CheckSourceLine(1)\n"
- " CheckSourceLine(2)\n"
- " CheckSourceLine(3)\n"
- "}; f()"))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine(0)"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
+ "function f() {\n"
+ " CheckSourceLine(1)\n"
+ " CheckSourceLine(2)\n"
+ " CheckSourceLine(3)\n"
+ "}; f()"))->Run();
// Test that a parameter can be passed to a function called in the debugger.
- v8::Script::Compile(v8::String::New("CheckDataParameter()"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
+ "CheckDataParameter()"))->Run();
// Test that a function with closure can be run in the debugger.
- v8::Script::Compile(v8::String::New("CheckClosure()"))->Run();
-
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(), "CheckClosure()"))->Run();
// Test that the source line is correct when there is a line offset.
- v8::ScriptOrigin origin(v8::String::New("test"),
+ v8::ScriptOrigin origin(v8::String::NewFromUtf8(CcTest::isolate(), "test"),
v8::Integer::New(7));
- v8::Script::Compile(v8::String::New("CheckSourceLine(7)"), &origin)->Run();
- v8::Script::Compile(v8::String::New("function f() {\n"
- " CheckSourceLine(8)\n"
- " CheckSourceLine(9)\n"
- " CheckSourceLine(10)\n"
- "}; f()"), &origin)->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine(7)"), &origin)
+ ->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
+ "function f() {\n"
+ " CheckSourceLine(8)\n"
+ " CheckSourceLine(9)\n"
+ " CheckSourceLine(10)\n"
+ "}; f()"),
+ &origin)->Run();
}
@@ -5639,7 +5777,7 @@
// Get the test functions again.
v8::Local<v8::Function> foo(v8::Local<v8::Function>::Cast(
- env->Global()->Get(v8::String::New("foo"))));
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "foo"))));
foo->Call(env->Global(), 0, NULL);
CHECK_EQ(0, break_point_hit_count);
@@ -6135,7 +6273,11 @@
i::FLAG_allow_natives_syntax = allow_natives_syntax;
// Some scripts are retrieved - at least the number of native scripts.
- CHECK_GT((*env)->Global()->Get(v8::String::New("count"))->Int32Value(), 8);
+ CHECK_GT((*env)
+ ->Global()
+ ->Get(v8::String::NewFromUtf8(env->GetIsolate(), "count"))
+ ->Int32Value(),
+ 8);
}
@@ -6160,17 +6302,19 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakPointHitCount);
// Test function source.
- v8::Local<v8::String> script = v8::String::New(
- "function f() {\n"
- " debugger;\n"
- "}\n");
+ v8::Local<v8::String> script = v8::String::NewFromUtf8(env->GetIsolate(),
+ "function f() {\n"
+ " debugger;\n"
+ "}\n");
- v8::ScriptOrigin origin1 = v8::ScriptOrigin(v8::String::New("name"));
+ v8::ScriptOrigin origin1 =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "name"));
v8::Handle<v8::Script> script1 = v8::Script::Compile(script, &origin1);
- script1->SetData(v8::String::New("data"));
+ script1->SetData(v8::String::NewFromUtf8(env->GetIsolate(), "data"));
script1->Run();
v8::Local<v8::Function> f;
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
CHECK_EQ(1, break_point_hit_count);
@@ -6180,34 +6324,39 @@
// Compile the same script again without setting data. As the compilation
// cache is disabled when debugging expect the data to be missing.
v8::Script::Compile(script, &origin1)->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
CHECK_EQ(2, break_point_hit_count);
CHECK_EQ("name", last_script_name_hit);
CHECK_EQ("", last_script_data_hit); // Undefined results in empty string.
- v8::Local<v8::String> data_obj_source = v8::String::New(
- "({ a: 'abc',\n"
- " b: 123,\n"
- " toString: function() { return this.a + ' ' + this.b; }\n"
- "})\n");
+ v8::Local<v8::String> data_obj_source = v8::String::NewFromUtf8(
+ env->GetIsolate(),
+ "({ a: 'abc',\n"
+ " b: 123,\n"
+ " toString: function() { return this.a + ' ' + this.b; }\n"
+ "})\n");
v8::Local<v8::Value> data_obj = v8::Script::Compile(data_obj_source)->Run();
- v8::ScriptOrigin origin2 = v8::ScriptOrigin(v8::String::New("new name"));
+ v8::ScriptOrigin origin2 =
+ v8::ScriptOrigin(v8::String::NewFromUtf8(env->GetIsolate(), "new name"));
v8::Handle<v8::Script> script2 = v8::Script::Compile(script, &origin2);
script2->Run();
script2->SetData(data_obj->ToString());
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
CHECK_EQ(3, break_point_hit_count);
CHECK_EQ("new name", last_script_name_hit);
CHECK_EQ("abc 123", last_script_data_hit);
- v8::Handle<v8::Script> script3 =
- v8::Script::Compile(script, &origin2, NULL,
- v8::String::New("in compile"));
+ v8::Handle<v8::Script> script3 = v8::Script::Compile(
+ script, &origin2, NULL,
+ v8::String::NewFromUtf8(env->GetIsolate(), "in compile"));
CHECK_EQ("in compile", last_script_data_hit);
script3->Run();
- f = v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
CHECK_EQ(4, break_point_hit_count);
CHECK_EQ("in compile", last_script_data_hit);
@@ -6259,8 +6408,8 @@
CHECK(context_2->GetEmbedderData(0)->IsUndefined());
// Set and check different data values.
- v8::Handle<v8::String> data_1 = v8::String::New("1");
- v8::Handle<v8::String> data_2 = v8::String::New("2");
+ v8::Handle<v8::String> data_1 = v8::String::NewFromUtf8(isolate, "1");
+ v8::Handle<v8::String> data_2 = v8::String::NewFromUtf8(isolate, "2");
context_1->SetEmbedderData(0, data_1);
context_2->SetEmbedderData(0, data_2);
CHECK(context_1->GetEmbedderData(0)->StrictEquals(data_1));
@@ -6274,7 +6423,7 @@
v8::Context::Scope context_scope(context_1);
expected_context = context_1;
expected_context_data = data_1;
- v8::Local<v8::Function> f = CompileFunction(source, "f");
+ v8::Local<v8::Function> f = CompileFunction(isolate, source, "f");
f->Call(context_1->Global(), 0, NULL);
}
@@ -6284,7 +6433,7 @@
v8::Context::Scope context_scope(context_2);
expected_context = context_2;
expected_context_data = data_2;
- v8::Local<v8::Function> f = CompileFunction(source, "f");
+ v8::Local<v8::Function> f = CompileFunction(isolate, source, "f");
f->Call(context_2->Global(), 0, NULL);
}
@@ -6325,10 +6474,10 @@
// Test functions.
const char* script = "function f() { debugger; g(); } function g() { }";
CompileRun(script);
- v8::Local<v8::Function> f =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
- v8::Local<v8::Function> g =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("g")));
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
+ v8::Local<v8::Function> g = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "g")));
// Call f then g. The debugger statement in f will casue a break which will
// cause another break.
@@ -6391,9 +6540,10 @@
"var sourceLineBeginningSkip = /^(?:[ \\v\\h]*(?:\\/\\*.*?\\*\\/)*)*/;\n"
"function f(s) { return s.match(sourceLineBeginningSkip)[0].length; }";
- v8::Local<v8::Function> f = CompileFunction(script, "f");
+ v8::Local<v8::Function> f = CompileFunction(env->GetIsolate(), script, "f");
const int argc = 1;
- v8::Handle<v8::Value> argv[argc] = { v8::String::New(" /* xxx */ a=0;") };
+ v8::Handle<v8::Value> argv[argc] = {
+ v8::String::NewFromUtf8(env->GetIsolate(), " /* xxx */ a=0;")};
v8::Local<v8::Value> result = f->Call(env->Global(), argc, argv);
CHECK_EQ(12, result->Int32Value());
@@ -6425,7 +6575,8 @@
CHECK(context_1->GetEmbedderData(0)->IsUndefined());
// Set and check a data value.
- v8::Handle<v8::String> data_1 = v8::String::New("1");
+ v8::Handle<v8::String> data_1 =
+ v8::String::NewFromUtf8(CcTest::isolate(), "1");
context_1->SetEmbedderData(0, data_1);
CHECK(context_1->GetEmbedderData(0)->StrictEquals(data_1));
@@ -6437,7 +6588,7 @@
v8::Context::Scope context_scope(context_1);
expected_context = context_1;
expected_context_data = data_1;
- v8::Local<v8::Function> f = CompileFunction(source, "f");
+ v8::Local<v8::Function> f = CompileFunction(CcTest::isolate(), source, "f");
f->Call(context_1->Global(), 0, NULL);
}
@@ -6558,8 +6709,10 @@
script_collected_count = 0;
v8::Debug::SetDebugEventListener2(DebugEventScriptCollectedEvent);
{
- v8::Script::Compile(v8::String::New("eval('a=1')"))->Run();
- v8::Script::Compile(v8::String::New("eval('a=2')"))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "eval('a=1')"))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(env->GetIsolate(), "eval('a=2')"))->Run();
}
// Do garbage collection to collect the script above which is no longer
@@ -6618,8 +6771,8 @@
CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
v8::Debug::SetMessageHandler2(ScriptCollectedMessageHandler);
- v8::Script::Compile(v8::String::New("eval('a=1')"))->Run();
- v8::Script::Compile(v8::String::New("eval('a=2')"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, "eval('a=1')"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(isolate, "eval('a=2')"))->Run();
// Leave context
{
@@ -6628,7 +6781,7 @@
v8::Local<v8::Context>::New(isolate, context);
local_context->Exit();
}
- context.Dispose();
+ context.Reset();
// Do garbage collection to collect the script above which is no longer
// referenced.
@@ -6663,12 +6816,14 @@
const char* script = "var a=1";
v8::Debug::SetMessageHandler2(AfterCompileMessageHandler);
- v8::Script::Compile(v8::String::New(script))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), script))
+ ->Run();
v8::Debug::SetMessageHandler2(NULL);
v8::Debug::SetMessageHandler2(AfterCompileMessageHandler);
v8::Debug::DebugBreak(env->GetIsolate());
- v8::Script::Compile(v8::String::New(script))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), script))
+ ->Run();
// Setting listener to NULL should cause debugger unload.
v8::Debug::SetMessageHandler2(NULL);
@@ -6687,13 +6842,14 @@
const char* script = "function f() {};";
v8::Debug::SetMessageHandler2(AfterCompileMessageHandler);
- v8::Script::Compile(v8::String::New(script))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), script))
+ ->Run();
v8::Debug::SetMessageHandler2(NULL);
v8::Debug::SetMessageHandler2(AfterCompileMessageHandler);
v8::Debug::DebugBreak(env->GetIsolate());
- v8::Local<v8::Function> f =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
// Setting message handler to NULL should cause debugger unload.
@@ -6726,12 +6882,13 @@
const char* script = "function f() {throw new Error()};";
v8::Debug::SetMessageHandler2(AfterCompileMessageHandler);
- v8::Script::Compile(v8::String::New(script))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), script))
+ ->Run();
v8::Debug::SetMessageHandler2(NULL);
v8::Debug::SetMessageHandler2(ExceptionMessageHandler);
- v8::Local<v8::Function> f =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "f")));
f->Call(env->Global(), 0, NULL);
// Setting message handler to NULL should cause debugger unload.
@@ -6753,28 +6910,30 @@
// Set a couple of provisional breakpoint on lines out of the script lines
// range.
- int sbp1 = SetScriptBreakPointByNameFromJS(resource_name, 3,
- -1 /* no column */);
- int sbp2 = SetScriptBreakPointByNameFromJS(resource_name, 5, 5);
+ int sbp1 = SetScriptBreakPointByNameFromJS(env->GetIsolate(), resource_name,
+ 3, -1 /* no column */);
+ int sbp2 =
+ SetScriptBreakPointByNameFromJS(env->GetIsolate(), resource_name, 5, 5);
after_compile_message_count = 0;
v8::Debug::SetMessageHandler2(AfterCompileMessageHandler);
v8::ScriptOrigin origin(
- v8::String::New(resource_name),
+ v8::String::NewFromUtf8(env->GetIsolate(), resource_name),
v8::Integer::New(10),
v8::Integer::New(1));
// Compile a script whose first line number is greater than the breakpoints'
// lines.
- v8::Script::Compile(v8::String::New(script), &origin)->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), script),
+ &origin)->Run();
// If the script is compiled successfully there is exactly one after compile
// event. In case of an exception in debugger code after compile event is not
// sent.
CHECK_EQ(1, after_compile_message_count);
- ClearBreakPointFromJS(sbp1);
- ClearBreakPointFromJS(sbp2);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp1);
+ ClearBreakPointFromJS(env->GetIsolate(), sbp2);
v8::Debug::SetMessageHandler2(NULL);
}
@@ -6932,7 +7091,8 @@
v8::Debug::ProcessDebugMessages();
CHECK_EQ(BacktraceData::frame_counter, 0);
- v8::Handle<v8::String> void0 = v8::String::New("void(0)");
+ v8::Handle<v8::String> void0 =
+ v8::String::NewFromUtf8(env->GetIsolate(), "void(0)");
v8::Handle<v8::Script> script = v8::Script::Compile(void0, void0);
// Check backtrace from "void(0)" script.
@@ -6954,10 +7114,12 @@
TEST(GetMirror) {
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::Handle<v8::Value> obj = v8::Debug::GetMirror(v8::String::New("hodja"));
- v8::Handle<v8::Function> run_test = v8::Handle<v8::Function>::Cast(
- v8::Script::New(
- v8::String::New(
+ v8::Handle<v8::Value> obj =
+ v8::Debug::GetMirror(v8::String::NewFromUtf8(env->GetIsolate(), "hodja"));
+ v8::Handle<v8::Function> run_test =
+ v8::Handle<v8::Function>::Cast(v8::Script::New(
+ v8::String::NewFromUtf8(
+ env->GetIsolate(),
"function runTest(mirror) {"
" return mirror.isString() && (mirror.length() == 5);"
"}"
@@ -7058,9 +7220,9 @@
// Create object with 'a' property accessor.
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New();
- named->SetAccessor(v8::String::New("a"),
+ named->SetAccessor(v8::String::NewFromUtf8(env->GetIsolate(), "a"),
NamedGetterWithCallingContextCheck);
- env->Global()->Set(v8::String::New("obj"),
+ env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "obj"),
named->NewInstance());
// Register the debug event listener
@@ -7108,7 +7270,8 @@
v8::Debug::SetDebugEventListener2(DebugEventContextChecker,
expected_callback_data);
v8::Context::Scope context_scope(expected_context);
- v8::Script::Compile(v8::String::New("(function(){debugger;})();"))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(isolate, "(function(){debugger;})();"))->Run();
expected_context.Clear();
v8::Debug::SetDebugEventListener2(NULL);
expected_context_data = v8::Handle<v8::Value>();
@@ -7143,7 +7306,9 @@
was_debug_event_called = false;
was_debug_break_called = false;
v8::Debug::DebugBreakForCommand(NULL, isolate);
- v8::Script::Compile(v8::String::New("(function(x){return x;})(1);"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "(function(x){return x;})(1);"))
+ ->Run();
CHECK(was_debug_event_called);
CHECK(!was_debug_break_called);
@@ -7152,7 +7317,9 @@
was_debug_event_called = false;
was_debug_break_called = false;
v8::Debug::DebugBreakForCommand(data1, isolate);
- v8::Script::Compile(v8::String::New("(function(x){return x+1;})(1);"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "(function(x){return x+1;})(1);"))
+ ->Run();
CHECK(was_debug_event_called);
CHECK(!was_debug_break_called);
@@ -7160,7 +7327,9 @@
was_debug_event_called = false;
was_debug_break_called = false;
v8::Debug::DebugBreak(isolate);
- v8::Script::Compile(v8::String::New("(function(x){return x+2;})(1);"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "(function(x){return x+2;})(1);"))
+ ->Run();
CHECK(!was_debug_event_called);
CHECK(was_debug_break_called);
@@ -7170,7 +7339,9 @@
was_debug_break_called = false;
v8::Debug::DebugBreak(isolate);
v8::Debug::DebugBreakForCommand(data2, isolate);
- v8::Script::Compile(v8::String::New("(function(x){return x+3;})(1);"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "(function(x){return x+3;})(1);"))
+ ->Run();
CHECK(was_debug_event_called);
CHECK(was_debug_break_called);
@@ -7233,11 +7404,13 @@
v8::Debug::SetDebugEventListener2(DebugEventBreakDeoptimize);
// Compile and run function bar which will optimize it for some flag settings.
- v8::Script::Compile(v8::String::New("function bar(){}; bar()"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(
+ env->GetIsolate(), "function bar(){}; bar()"))->Run();
// Set debug break and call bar again.
v8::Debug::DebugBreak(env->GetIsolate());
- v8::Script::Compile(v8::String::New("bar()"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), "bar()"))
+ ->Run();
CHECK(debug_event_break_deoptimize_done);
@@ -7247,6 +7420,7 @@
static void DebugEventBreakWithOptimizedStack(
const v8::Debug::EventDetails& event_details) {
+ v8::Isolate* isolate = event_details.GetEventContext()->GetIsolate();
v8::DebugEvent event = event_details.GetEvent();
v8::Handle<v8::Object> exec_state = event_details.GetExecutionState();
if (event == v8::Break) {
@@ -7259,12 +7433,12 @@
frame_function_name->Call(exec_state, argc, argv);
CHECK(result->IsString());
v8::Handle<v8::String> function_name(result->ToString());
- CHECK(function_name->Equals(v8::String::New("loop")));
+ CHECK(function_name->Equals(v8::String::NewFromUtf8(isolate, "loop")));
// Get the name of the first argument in frame i.
result = frame_argument_name->Call(exec_state, argc, argv);
CHECK(result->IsString());
v8::Handle<v8::String> argument_name(result->ToString());
- CHECK(argument_name->Equals(v8::String::New("count")));
+ CHECK(argument_name->Equals(v8::String::NewFromUtf8(isolate, "count")));
// Get the value of the first argument in frame i. If the
// funtion is optimized the value will be undefined, otherwise
// the value will be '1 - i'.
@@ -7277,7 +7451,7 @@
result = frame_local_name->Call(exec_state, argc, argv);
CHECK(result->IsString());
v8::Handle<v8::String> local_name(result->ToString());
- CHECK(local_name->Equals(v8::String::New("local")));
+ CHECK(local_name->Equals(v8::String::NewFromUtf8(isolate, "local")));
// Get the value of the first local variable. If the function
// is optimized the value will be undefined, otherwise it will
// be 42.
@@ -7326,7 +7500,7 @@
" if (count < 1) { scheduleBreak(); loop(count + 1); }"
"}"
"loop(0);";
- v8::Script::Compile(v8::String::New(src))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), src))->Run();
}
@@ -7470,7 +7644,8 @@
"%OptimizeFunctionOnNextCall(g); \n"
"g(true);";
v8::Debug::SetDebugEventListener2(DebugBreakInlineListener);
- inline_script = v8::Script::Compile(v8::String::New(source));
+ inline_script =
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(), source));
inline_script->Run();
}
diff --git a/test/cctest/test-declarative-accessors.cc b/test/cctest/test-declarative-accessors.cc
index fb22ccd..af3ffc3 100644
--- a/test/cctest/test-declarative-accessors.cc
+++ b/test/cctest/test-declarative-accessors.cc
@@ -42,8 +42,7 @@
void Reset() {
for (unsigned i = 0; i < kArraySize; i++) {
if (handles_[i].IsEmpty()) continue;
- handles_[i].Dispose();
- handles_[i].Clear();
+ handles_[i].Reset();
}
}
v8::Persistent<v8::Value> handles_[kArraySize];
diff --git a/test/cctest/test-decls.cc b/test/cctest/test-decls.cc
index 1d09f9c..c3bd5c4 100644
--- a/test/cctest/test-decls.cc
+++ b/test/cctest/test-decls.cc
@@ -56,7 +56,7 @@
HandleScope scope(isolate);
Local<Context> context = Local<Context>::New(isolate, context_);
context->Exit();
- context_.Dispose();
+ context_.Reset();
}
}
@@ -147,7 +147,8 @@
HandleScope scope(CcTest::isolate());
TryCatch catcher;
catcher.SetVerbose(true);
- Local<Script> script = Script::Compile(String::New(source));
+ Local<Script> script =
+ Script::Compile(String::NewFromUtf8(CcTest::isolate(), source));
if (expectations == EXPECT_ERROR) {
CHECK(script.IsEmpty());
return;
@@ -729,7 +730,8 @@
HandleScope scope(context_->GetIsolate());
TryCatch catcher;
catcher.SetVerbose(true);
- Local<Script> script = Script::Compile(String::New(source));
+ Local<Script> script =
+ Script::Compile(String::NewFromUtf8(context_->GetIsolate(), source));
if (expectations == EXPECT_ERROR) {
CHECK(script.IsEmpty());
return;
diff --git a/test/cctest/test-deoptimization.cc b/test/cctest/test-deoptimization.cc
index c9200ed..4b69612 100644
--- a/test/cctest/test-deoptimization.cc
+++ b/test/cctest/test-deoptimization.cc
@@ -235,8 +235,8 @@
CHECK_EQ(11, env->Global()->Get(v8_str("calls"))->Int32Value());
CHECK_EQ(0, Deoptimizer::GetDeoptimizedCodeCount(CcTest::i_isolate()));
- v8::Local<v8::Function> fun =
- v8::Local<v8::Function>::Cast(env->Global()->Get(v8::String::New("f")));
+ v8::Local<v8::Function> fun = v8::Local<v8::Function>::Cast(
+ env->Global()->Get(v8::String::NewFromUtf8(CcTest::isolate(), "f")));
CHECK(!fun.IsEmpty());
}
diff --git a/test/cctest/test-func-name-inference.cc b/test/cctest/test-func-name-inference.cc
index 1a000af..4e9d1b1 100644
--- a/test/cctest/test-func-name-inference.cc
+++ b/test/cctest/test-func-name-inference.cc
@@ -94,8 +94,8 @@
}
-static v8::Handle<v8::Script> Compile(const char* src) {
- return v8::Script::Compile(v8::String::New(src));
+static v8::Handle<v8::Script> Compile(v8::Isolate* isolate, const char* src) {
+ return v8::Script::Compile(v8::String::NewFromUtf8(isolate, src));
}
@@ -104,6 +104,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"fun1 = function() { return 1; }\n"
"fun2 = function() { return 2; }\n");
CheckFunctionName(script, "return 1", "fun1");
@@ -116,6 +117,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"var fun1 = function() { return 1; }\n"
"var fun2 = function() { return 2; }\n");
CheckFunctionName(script, "return 1", "fun1");
@@ -128,6 +130,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function outer() {\n"
" var fun1 = function() { return 1; }\n"
" var fun2 = function() { return 2; }\n"
@@ -142,6 +145,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function MyClass() {\n"
" this.method1 = function() { return 1; }\n"
" this.method2 = function() { return 2; }\n"
@@ -156,6 +160,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" obj.method1 = function() { return 1; }\n"
@@ -172,6 +177,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.static1 = function() { return 1; }\n"
"MyClass.static2 = function() { return 2; }\n"
@@ -190,6 +196,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.prototype.method1 = function() { return 1; }\n"
"MyClass.prototype.method2 = function() { return 2; }\n"
@@ -208,6 +215,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.prototype = {\n"
" method1: function() { return 1; },\n"
@@ -222,6 +230,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function f1(a) { return a(); }\n"
"function f2(a, b) { return a() + b(); }\n"
"var result1 = f1(function() { return 1; })\n"
@@ -238,6 +247,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"fun1 = 0 ?\n"
" function() { return 1; } :\n"
" function() { return 2; }");
@@ -251,6 +261,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function MyClass() {}\n"
"MyClass.prototype = {\n"
" method1: 0 ? function() { return 1; } :\n"
@@ -265,6 +276,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"(function() {\n"
" (function() {\n"
" var a = 1;\n"
@@ -284,6 +296,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"(function() {\n"
" (function() {\n"
" var a = 1;\n"
@@ -300,6 +313,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"var foo = function() {\n"
" (function named() {\n"
" var a = 1;\n"
@@ -317,6 +331,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function a() {\n"
"var result = function(p,a,c,k,e,d)"
"{return p}(\"if blah blah\",62,1976,\'a|b\'.split(\'|\'),0,{})\n"
@@ -330,6 +345,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"var fun1 = fun2 = function () { return 1; }\n"
"var bar1 = bar2 = bar3 = function () { return 2; }\n"
"foo1 = foo2 = function () { return 3; }\n"
@@ -346,6 +362,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function Foo() {}\n"
"var foo = new Foo(function() { return 1; })\n"
"var bar = new Foo(function() { return 2; }, function() { return 3; })");
@@ -360,6 +377,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" obj[\"method1\"] = function() { return 1; }\n"
@@ -376,6 +394,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" var methodName = \"method1\";\n"
@@ -395,6 +414,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"function createMyObj() {\n"
" var obj = {};\n"
" obj[0 ? \"method1\" : \"method2\"] = function() { return 1; }\n"
@@ -410,6 +430,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"var Foo = function() {\n"
" return 1;\n"
"}();\n"
@@ -428,6 +449,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"(function Enclosing() {\n"
" var Foo;\n"
" Foo = function() {\n"
@@ -451,6 +473,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"(function () {\n"
" var EventSource = function () { };\n"
" EventSource.prototype.addListener = function () {\n"
@@ -467,6 +490,7 @@
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Script> script = Compile(
+ CcTest::isolate(),
"(function() {\n"
" function wrapCode() {\n"
" return function () {\n"
diff --git a/test/cctest/test-heap-profiler.cc b/test/cctest/test-heap-profiler.cc
index 23fe1c2..86ed230 100644
--- a/test/cctest/test-heap-profiler.cc
+++ b/test/cctest/test-heap-profiler.cc
@@ -255,7 +255,8 @@
const v8::HeapGraphNode* f =
GetProperty(global, v8::HeapGraphEdge::kProperty, "boundFunction");
CHECK(f);
- CHECK_EQ(v8::String::New("native_bind"), f->GetName());
+ CHECK_EQ(v8::String::NewFromUtf8(env->GetIsolate(), "native_bind"),
+ f->GetName());
const v8::HeapGraphNode* bindings =
GetProperty(f, v8::HeapGraphEdge::kInternal, "bindings");
CHECK_NE(NULL, bindings);
@@ -1083,8 +1084,8 @@
GetProperty(global, v8::HeapGraphEdge::kProperty, "globalObject");
CHECK(global_object);
- v8::Local<v8::Value> globalObjectHandle =
- env->Global()->Get(v8::String::New("globalObject"));
+ v8::Local<v8::Value> globalObjectHandle = env->Global()->Get(
+ v8::String::NewFromUtf8(env->GetIsolate(), "globalObject"));
CHECK(!globalObjectHandle.IsEmpty());
CHECK(globalObjectHandle->IsObject());
@@ -1719,7 +1720,8 @@
GetProperty(c, v8::HeapGraphEdge::kInternal, "hidden_properties");
CHECK_EQ(NULL, hidden_props);
- v8::Handle<v8::Value> cHandle = env->Global()->Get(v8::String::New("c"));
+ v8::Handle<v8::Value> cHandle =
+ env->Global()->Get(v8::String::NewFromUtf8(env->GetIsolate(), "c"));
CHECK(!cHandle.IsEmpty() && cHandle->IsObject());
cHandle->ToObject()->SetHiddenValue(v8_str("key"), v8_str("val"));
@@ -1763,7 +1765,7 @@
static void PersistentHandleCallback(v8::Isolate* isolate,
v8::Persistent<v8::Value>* handle,
void*) {
- handle->Dispose();
+ handle->Reset();
}
@@ -2036,7 +2038,8 @@
v8::Handle<v8::FunctionTemplate> HeapProfilerExtension::GetNativeFunction(
v8::Handle<v8::String> name) {
- if (name->Equals(v8::String::New("findUntrackedObjects"))) {
+ if (name->Equals(v8::String::NewFromUtf8(v8::Isolate::GetCurrent(),
+ "findUntrackedObjects"))) {
return v8::FunctionTemplate::New(
HeapProfilerExtension::FindUntrackedObjects);
} else {
@@ -2212,7 +2215,7 @@
CompileRun(record_trace_tree_source);
const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(
- v8::String::New("Test"));
+ v8::String::NewFromUtf8(env->GetIsolate(), "Test"));
i::HeapSnapshotsCollection* collection = ToInternal(snapshot)->collection();
AllocationTracker* tracker = collection->allocation_tracker();
CHECK_NE(NULL, tracker);
@@ -2265,7 +2268,7 @@
CompileRun(inline_heap_allocation_source);
const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(
- v8::String::New("Test2"));
+ v8::String::NewFromUtf8(env->GetIsolate(), "Test2"));
i::HeapSnapshotsCollection* collection = ToInternal(snapshot)->collection();
AllocationTracker* tracker = collection->allocation_tracker();
CHECK_NE(NULL, tracker);
@@ -2293,7 +2296,7 @@
CompileRun(inline_heap_allocation_source);
const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(
- v8::String::New("Test1"));
+ v8::String::NewFromUtf8(env->GetIsolate(), "Test1"));
i::HeapSnapshotsCollection* collection = ToInternal(snapshot)->collection();
AllocationTracker* tracker = collection->allocation_tracker();
CHECK_NE(NULL, tracker);
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 29533d4..d8678c5 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -397,7 +397,7 @@
v8::Persistent<v8::Value>* handle,
void* id) {
if (1234 == reinterpret_cast<intptr_t>(id)) WeakPointerCleared = true;
- handle->Dispose();
+ handle->Reset();
}
@@ -1787,12 +1787,12 @@
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0));
ctx2->Exit();
v8::Local<v8::Context>::New(isolate, ctx1)->Exit();
- ctx1p.Dispose();
+ ctx1p.Reset();
v8::V8::ContextDisposedNotification();
}
CcTest::heap()->CollectAllAvailableGarbage();
CHECK_EQ(2, NumberOfGlobalObjects());
- ctx2p.Dispose();
+ ctx2p.Reset();
CcTest::heap()->CollectAllAvailableGarbage();
CHECK_EQ(0, NumberOfGlobalObjects());
}
@@ -1833,12 +1833,12 @@
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0));
ctx2->Exit();
ctx1->Exit();
- ctx1p.Dispose();
+ ctx1p.Reset();
v8::V8::ContextDisposedNotification();
}
CcTest::heap()->CollectAllAvailableGarbage();
CHECK_EQ(2, NumberOfGlobalObjects());
- ctx2p.Dispose();
+ ctx2p.Reset();
CcTest::heap()->CollectAllAvailableGarbage();
CHECK_EQ(0, NumberOfGlobalObjects());
}
@@ -1877,12 +1877,12 @@
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0));
ctx2->Exit();
ctx1->Exit();
- ctx1p.Dispose();
+ ctx1p.Reset();
v8::V8::ContextDisposedNotification();
}
CcTest::heap()->CollectAllAvailableGarbage();
CHECK_EQ(2, NumberOfGlobalObjects());
- ctx2p.Dispose();
+ ctx2p.Reset();
CcTest::heap()->CollectAllAvailableGarbage();
CHECK_EQ(0, NumberOfGlobalObjects());
}
@@ -1925,12 +1925,12 @@
ctx2->Global()->Set(v8_str("o"), v8::Int32::New(0));
ctx2->Exit();
ctx1->Exit();
- ctx1p.Dispose();
+ ctx1p.Reset();
v8::V8::ContextDisposedNotification();
}
CcTest::heap()->CollectAllAvailableGarbage();
CHECK_EQ(2, NumberOfGlobalObjects());
- ctx2p.Dispose();
+ ctx2p.Reset();
CcTest::heap()->CollectAllAvailableGarbage();
CHECK_EQ(0, NumberOfGlobalObjects());
}
diff --git a/test/cctest/test-lockers.cc b/test/cctest/test-lockers.cc
index 1094512..12b35a5 100644
--- a/test/cctest/test-lockers.cc
+++ b/test/cctest/test-lockers.cc
@@ -667,7 +667,7 @@
v8::HandleScope handle_scope(isolate);
v8::Handle<Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
- v8::Handle<String> source = v8::String::New("1+1");
+ v8::Handle<String> source = v8::String::NewFromUtf8(isolate, "1+1");
v8::Handle<Script> script = v8::Script::Compile(source);
v8::Handle<Value> result = script->Run();
v8::String::Utf8Value utf8(result);
diff --git a/test/cctest/test-log-stack-tracer.cc b/test/cctest/test-log-stack-tracer.cc
index 4a0717d..85fdf45 100644
--- a/test/cctest/test-log-stack-tracer.cc
+++ b/test/cctest/test-log-stack-tracer.cc
@@ -113,13 +113,16 @@
v8::Handle<v8::FunctionTemplate> TraceExtension::GetNativeFunction(
v8::Handle<String> name) {
- if (name->Equals(String::New("trace"))) {
+ if (name->Equals(String::NewFromUtf8(v8::Isolate::GetCurrent(), "trace"))) {
return v8::FunctionTemplate::New(TraceExtension::Trace);
- } else if (name->Equals(String::New("js_trace"))) {
+ } else if (name->Equals(
+ String::NewFromUtf8(v8::Isolate::GetCurrent(), "js_trace"))) {
return v8::FunctionTemplate::New(TraceExtension::JSTrace);
- } else if (name->Equals(String::New("js_entry_sp"))) {
+ } else if (name->Equals(String::NewFromUtf8(v8::Isolate::GetCurrent(),
+ "js_entry_sp"))) {
return v8::FunctionTemplate::New(TraceExtension::JSEntrySP);
- } else if (name->Equals(String::New("js_entry_sp_level2"))) {
+ } else if (name->Equals(String::NewFromUtf8(v8::Isolate::GetCurrent(),
+ "js_entry_sp_level2"))) {
return v8::FunctionTemplate::New(TraceExtension::JSEntrySPLevel2);
} else {
CHECK(false);
diff --git a/test/cctest/test-log.cc b/test/cctest/test-log.cc
index 2cf2a77..b838fda 100644
--- a/test/cctest/test-log.cc
+++ b/test/cctest/test-log.cc
@@ -307,7 +307,8 @@
SimpleExternalString source_ext_str("(function ext() {})();");
v8::Local<v8::String> source = v8::String::NewExternal(&source_ext_str);
// Script needs to have a name in order to trigger InitLineEnds execution.
- v8::Handle<v8::String> origin = v8::String::New("issue-23768-test");
+ v8::Handle<v8::String> origin =
+ v8::String::NewFromUtf8(CcTest::isolate(), "issue-23768-test");
v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin);
CHECK(!evil_script.IsEmpty());
CHECK(!evil_script->Run().IsEmpty());
@@ -451,12 +452,14 @@
i::Vector<const char> log(
i::ReadFile(initialize_logger.StopLoggingGetTempFile(), &exists, true));
CHECK(exists);
- v8::Handle<v8::String> log_str = v8::String::New(log.start(), log.length());
+ v8::Handle<v8::String> log_str = v8::String::NewFromUtf8(
+ CcTest::isolate(), log.start(), v8::String::kNormalString, log.length());
initialize_logger.env()->Global()->Set(v8_str("_log"), log_str);
i::Vector<const unsigned char> source = TestSources::GetScriptsSource();
- v8::Handle<v8::String> source_str = v8::String::New(
- reinterpret_cast<const char*>(source.start()), source.length());
+ v8::Handle<v8::String> source_str = v8::String::NewFromUtf8(
+ CcTest::isolate(), reinterpret_cast<const char*>(source.start()),
+ v8::String::kNormalString, source.length());
v8::TryCatch try_catch;
v8::Handle<v8::Script> script = v8::Script::Compile(source_str, v8_str(""));
if (script.IsEmpty()) {
diff --git a/test/cctest/test-mark-compact.cc b/test/cctest/test-mark-compact.cc
index e62bdeb..a463432 100644
--- a/test/cctest/test-mark-compact.cc
+++ b/test/cctest/test-mark-compact.cc
@@ -250,7 +250,7 @@
void* id) {
ASSERT(id == reinterpret_cast<void*>(1234));
NumberOfWeakCalls++;
- handle->Dispose();
+ handle->Reset();
}
diff --git a/test/cctest/test-object-observe.cc b/test/cctest/test-object-observe.cc
index 129e9d0..ce56111 100644
--- a/test/cctest/test-object-observe.cc
+++ b/test/cctest/test-object-observe.cc
@@ -72,23 +72,29 @@
Handle<Value> notify_fun2;
{
LocalContext context2(isolate.GetIsolate());
- context2->Global()->Set(String::New("obj"), obj);
+ context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ obj);
notify_fun2 = CompileRun(
"(function() { obj.foo = 'baz'; })");
}
Handle<Value> notify_fun3;
{
LocalContext context3(isolate.GetIsolate());
- context3->Global()->Set(String::New("obj"), obj);
+ context3->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ obj);
notify_fun3 = CompileRun(
"(function() { obj.foo = 'bat'; })");
}
{
LocalContext context4(isolate.GetIsolate());
- context4->Global()->Set(String::New("observer"), observer);
- context4->Global()->Set(String::New("fun1"), notify_fun1);
- context4->Global()->Set(String::New("fun2"), notify_fun2);
- context4->Global()->Set(String::New("fun3"), notify_fun3);
+ context4->Global()->Set(
+ String::NewFromUtf8(isolate.GetIsolate(), "observer"), observer);
+ context4->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "fun1"),
+ notify_fun1);
+ context4->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "fun2"),
+ notify_fun2);
+ context4->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "fun3"),
+ notify_fun3);
CompileRun("fun1(); fun2(); fun3(); Object.deliverChangeRecords(observer)");
}
CHECK_EQ(1, CompileRun("calls")->Int32Value());
@@ -211,8 +217,10 @@
{
// As does initializing this context.
LocalContext context2(isolate.GetIsolate());
- context2->Global()->Set(String::New("obj"), obj);
- context2->Global()->Set(String::New("observer"), observer);
+ context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ obj);
+ context2->Global()->Set(
+ String::NewFromUtf8(isolate.GetIsolate(), "observer"), observer);
CompileRun(
"var objArr = [];"
// 100 objects should be enough to make the hash table grow
@@ -300,7 +308,8 @@
// TODO(adamk): Use this helper elsewhere in this file.
-static void ExpectRecords(Handle<Value> records,
+static void ExpectRecords(v8::Isolate* isolate,
+ Handle<Value> records,
const RecordExpectation expectations[],
int num) {
CHECK(records->IsArray());
@@ -311,22 +320,23 @@
CHECK(record->IsObject());
Handle<Object> recordObj = record.As<Object>();
CHECK(expectations[i].object->StrictEquals(
- recordObj->Get(String::New("object"))));
- CHECK(String::New(expectations[i].type)->Equals(
- recordObj->Get(String::New("type"))));
+ recordObj->Get(String::NewFromUtf8(isolate, "object"))));
+ CHECK(String::NewFromUtf8(isolate, expectations[i].type)->Equals(
+ recordObj->Get(String::NewFromUtf8(isolate, "type"))));
if (strcmp("splice", expectations[i].type) != 0) {
- CHECK(String::New(expectations[i].name)->Equals(
- recordObj->Get(String::New("name"))));
+ CHECK(String::NewFromUtf8(isolate, expectations[i].name)->Equals(
+ recordObj->Get(String::NewFromUtf8(isolate, "name"))));
if (!expectations[i].old_value.IsEmpty()) {
CHECK(expectations[i].old_value->Equals(
- recordObj->Get(String::New("oldValue"))));
+ recordObj->Get(String::NewFromUtf8(isolate, "oldValue"))));
}
}
}
}
-#define EXPECT_RECORDS(records, expectations) \
- ExpectRecords(records, expectations, ARRAY_SIZE(expectations))
+#define EXPECT_RECORDS(records, expectations) \
+ ExpectRecords(isolate.GetIsolate(), records, expectations, \
+ ARRAY_SIZE(expectations))
TEST(APITestBasicMutation) {
HarmonyIsolate isolate;
@@ -338,16 +348,17 @@
"function observer(r) { [].push.apply(records, r); };"
"Object.observe(obj, observer);"
"obj"));
- obj->Set(String::New("foo"), Number::New(7));
+ obj->Set(String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(7));
obj->Set(1, Number::New(2));
// ForceSet should work just as well as Set
- obj->ForceSet(String::New("foo"), Number::New(3));
+ obj->ForceSet(String::NewFromUtf8(isolate.GetIsolate(), "foo"),
+ Number::New(3));
obj->ForceSet(Number::New(1), Number::New(4));
// Setting an indexed element via the property setting method
obj->Set(Number::New(1), Number::New(5));
// Setting with a non-String, non-uint32 key
obj->Set(Number::New(1.1), Number::New(6), DontDelete);
- obj->Delete(String::New("foo"));
+ obj->Delete(String::NewFromUtf8(isolate.GetIsolate(), "foo"));
obj->Delete(1);
obj->ForceDelete(Number::New(1.1));
@@ -378,12 +389,14 @@
LocalContext context(isolate.GetIsolate());
Handle<FunctionTemplate> tmpl = FunctionTemplate::New();
tmpl->SetHiddenPrototype(true);
- tmpl->InstanceTemplate()->Set(String::New("foo"), Number::New(75));
+ tmpl->InstanceTemplate()->Set(
+ String::NewFromUtf8(isolate.GetIsolate(), "foo"), Number::New(75));
Handle<Object> proto = tmpl->GetFunction()->NewInstance();
Handle<Object> obj = Object::New();
obj->SetPrototype(proto);
- context->Global()->Set(String::New("obj"), obj);
- context->Global()->Set(String::New("proto"), proto);
+ context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"), obj);
+ context->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "proto"),
+ proto);
CompileRun(
"var records;"
"function observer(r) { records = r; };"
@@ -504,6 +517,7 @@
static Handle<Object> CreateAccessCheckedObject(
+ v8::Isolate* isolate,
NamedSecurityCallback namedCallback,
IndexedSecurityCallback indexedCallback,
Handle<Value> data = Handle<Value>()) {
@@ -511,7 +525,7 @@
tmpl->SetAccessCheckCallbacks(namedCallback, indexedCallback, data);
Handle<Object> instance = tmpl->NewInstance();
Handle<Object> global = instance->CreationContext()->Global();
- global->Set(String::New("obj"), instance);
+ global->Set(String::NewFromUtf8(isolate, "obj"), instance);
global->Set(kBlockedContextIndex, v8::True());
return instance;
}
@@ -525,9 +539,10 @@
LocalContext context(isolate.GetIsolate());
g_access_block_type = types[i];
Handle<Object> instance = CreateAccessCheckedObject(
+ isolate.GetIsolate(),
NamedAccessAllowUnlessBlocked,
IndexedAccessAlwaysAllowed,
- String::New("foo"));
+ String::NewFromUtf8(isolate.GetIsolate(), "foo"));
CompileRun("var records = null;"
"var objNoCheck = {};"
"var observer = function(r) { records = r };"
@@ -536,8 +551,11 @@
Handle<Value> obj_no_check = CompileRun("objNoCheck");
{
LocalContext context2(isolate.GetIsolate());
- context2->Global()->Set(String::New("obj"), instance);
- context2->Global()->Set(String::New("objNoCheck"), obj_no_check);
+ context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ instance);
+ context2->Global()->Set(
+ String::NewFromUtf8(isolate.GetIsolate(), "objNoCheck"),
+ obj_no_check);
CompileRun("var records2 = null;"
"var observer2 = function(r) { records2 = r };"
"Object.observe(obj, observer2);"
@@ -549,7 +567,8 @@
"objNoCheck.baz = 'quux'");
const RecordExpectation expected_records2[] = {
{ instance, "add", "foo", Handle<Value>() },
- { instance, "update", "foo", String::New("bar") },
+ { instance, "update", "foo",
+ String::NewFromUtf8(isolate.GetIsolate(), "bar") },
{ instance, "reconfigure", "foo", Number::New(5) },
{ instance, "add", "bar", Handle<Value>() },
{ obj_no_check, "add", "baz", Handle<Value>() },
@@ -573,8 +592,8 @@
LocalContext context(isolate.GetIsolate());
g_access_block_type = types[i];
Handle<Object> instance = CreateAccessCheckedObject(
- NamedAccessAlwaysAllowed, IndexedAccessAllowUnlessBlocked,
- Number::New(7));
+ isolate.GetIsolate(), NamedAccessAlwaysAllowed,
+ IndexedAccessAllowUnlessBlocked, Number::New(7));
CompileRun("var records = null;"
"var objNoCheck = {};"
"var observer = function(r) { records = r };"
@@ -583,8 +602,11 @@
Handle<Value> obj_no_check = CompileRun("objNoCheck");
{
LocalContext context2(isolate.GetIsolate());
- context2->Global()->Set(String::New("obj"), instance);
- context2->Global()->Set(String::New("objNoCheck"), obj_no_check);
+ context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ instance);
+ context2->Global()->Set(
+ String::NewFromUtf8(isolate.GetIsolate(), "objNoCheck"),
+ obj_no_check);
CompileRun("var records2 = null;"
"var observer2 = function(r) { records2 = r };"
"Object.observe(obj, observer2);"
@@ -596,7 +618,8 @@
"objNoCheck[42] = 'quux'");
const RecordExpectation expected_records2[] = {
{ instance, "add", "7", Handle<Value>() },
- { instance, "update", "7", String::New("foo") },
+ { instance, "update", "7",
+ String::NewFromUtf8(isolate.GetIsolate(), "foo") },
{ instance, "reconfigure", "7", Number::New(5) },
{ instance, "add", "8", Handle<Value>() },
{ obj_no_check, "add", "42", Handle<Value>() }
@@ -618,8 +641,8 @@
LocalContext context(isolate.GetIsolate());
g_access_block_type = ACCESS_GET;
Handle<Object> instance = CreateAccessCheckedObject(
- NamedAccessAlwaysAllowed, IndexedAccessAllowUnlessBlocked,
- Number::New(1));
+ isolate.GetIsolate(), NamedAccessAlwaysAllowed,
+ IndexedAccessAllowUnlessBlocked, Number::New(1));
CompileRun("var records = null;"
"obj[1] = 'foo';"
"obj.length = 2;"
@@ -630,8 +653,10 @@
Handle<Value> obj_no_check = CompileRun("objNoCheck");
{
LocalContext context2(isolate.GetIsolate());
- context2->Global()->Set(String::New("obj"), instance);
- context2->Global()->Set(String::New("objNoCheck"), obj_no_check);
+ context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ instance);
+ context2->Global()->Set(
+ String::NewFromUtf8(isolate.GetIsolate(), "objNoCheck"), obj_no_check);
CompileRun("var records2 = null;"
"var observer2 = function(r) { records2 = r };"
"Array.observe(obj, observer2);"
@@ -662,7 +687,7 @@
HandleScope scope(isolate.GetIsolate());
LocalContext context(isolate.GetIsolate());
Handle<Object> instance = CreateAccessCheckedObject(
- BlockAccessKeys, IndexedAccessAlwaysAllowed);
+ isolate.GetIsolate(), BlockAccessKeys, IndexedAccessAlwaysAllowed);
CompileRun("var records = null;"
"var objNoCheck = {};"
"var observer = function(r) { records = r };"
@@ -671,8 +696,10 @@
Handle<Value> obj_no_check = CompileRun("objNoCheck");
{
LocalContext context2(isolate.GetIsolate());
- context2->Global()->Set(String::New("obj"), instance);
- context2->Global()->Set(String::New("objNoCheck"), obj_no_check);
+ context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ instance);
+ context2->Global()->Set(
+ String::NewFromUtf8(isolate.GetIsolate(), "objNoCheck"), obj_no_check);
CompileRun("var records2 = null;"
"var observer2 = function(r) { records2 = r };"
"Object.observe(obj, observer2);"
@@ -699,18 +726,20 @@
HandleScope scope(isolate.GetIsolate());
LocalContext context(isolate.GetIsolate());
Handle<Object> instance = CreateAccessCheckedObject(
- BlockAccessKeys, IndexedAccessAlwaysAllowed);
+ isolate.GetIsolate(), BlockAccessKeys, IndexedAccessAlwaysAllowed);
CompileRun("var records = null;"
"var observer = function(r) { records = r };"
"Object.observe(obj, observer);");
{
LocalContext context2(isolate.GetIsolate());
- context2->Global()->Set(String::New("obj"), instance);
+ context2->Global()->Set(String::NewFromUtf8(isolate.GetIsolate(), "obj"),
+ instance);
CompileRun("var records2 = null;"
"var observer2 = function(r) { records2 = r };"
"Object.observe(obj, observer2);");
- instance->Set(5, String::New("bar"));
- instance->Set(String::New("foo"), String::New("bar"));
+ instance->Set(5, String::NewFromUtf8(isolate.GetIsolate(), "bar"));
+ instance->Set(String::NewFromUtf8(isolate.GetIsolate(), "foo"),
+ String::NewFromUtf8(isolate.GetIsolate(), "bar"));
CompileRun(""); // trigger delivery
const RecordExpectation expected_records2[] = {
{ instance, "add", "5", Handle<Value>() },
@@ -730,8 +759,10 @@
"var records = null;"
"var observer = function(r) { records = r };"
"Object.observe(obj, observer);");
- Handle<Value> obj = context->Global()->Get(String::New("obj"));
- Handle<Object>::Cast(obj)->SetHiddenValue(String::New("foo"), Null());
+ Handle<Value> obj =
+ context->Global()->Get(String::NewFromUtf8(isolate.GetIsolate(), "obj"));
+ Handle<Object>::Cast(obj)->SetHiddenValue(
+ String::NewFromUtf8(isolate.GetIsolate(), "foo"), Null());
CompileRun(""); // trigger delivery
CHECK(CompileRun("records")->IsNull());
}
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index 952cb68..e484dd9 100644
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -1050,15 +1050,14 @@
i::Factory* factory = isolate->factory();
const char* message = data->BuildMessage();
i::Handle<i::String> format = v8::Utils::OpenHandle(
- *v8::String::New(message));
+ *v8::String::NewFromUtf8(CcTest::isolate(), message));
i::Vector<const char*> args = data->BuildArgs();
i::Handle<i::JSArray> args_array = factory->NewJSArray(args.length());
for (int i = 0; i < args.length(); i++) {
- i::JSArray::SetElement(args_array,
- i,
- v8::Utils::OpenHandle(*v8::String::New(args[i])),
- NONE,
- i::kNonStrictMode);
+ i::JSArray::SetElement(
+ args_array, i, v8::Utils::OpenHandle(*v8::String::NewFromUtf8(
+ CcTest::isolate(), args[i])),
+ NONE, i::kNonStrictMode);
}
i::Handle<i::JSObject> builtins(isolate->js_builtins_object());
i::Handle<i::Object> format_fun =
@@ -1329,7 +1328,7 @@
" 01; \n"
" }; \n"
"}; \n";
- v8::Script::Compile(v8::String::New(script));
+ v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script));
CHECK(try_catch.HasCaught());
v8::String::Utf8Value exception(try_catch.Exception());
CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.",
diff --git a/test/cctest/test-profile-generator.cc b/test/cctest/test-profile-generator.cc
index 47146ec..fd223c6 100644
--- a/test/cctest/test-profile-generator.cc
+++ b/test/cctest/test-profile-generator.cc
@@ -556,9 +556,11 @@
v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunction(
v8::Handle<v8::String> name) {
- if (name->Equals(v8::String::New("startProfiling"))) {
+ if (name->Equals(v8::String::NewFromUtf8(v8::Isolate::GetCurrent(),
+ "startProfiling"))) {
return v8::FunctionTemplate::New(ProfilerExtension::StartProfiling);
- } else if (name->Equals(v8::String::New("stopProfiling"))) {
+ } else if (name->Equals(v8::String::NewFromUtf8(v8::Isolate::GetCurrent(),
+ "stopProfiling"))) {
return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling);
} else {
CHECK(false);
@@ -573,7 +575,8 @@
if (args.Length() > 0)
cpu_profiler->StartCpuProfiling(args[0].As<v8::String>());
else
- cpu_profiler->StartCpuProfiling(v8::String::New(""));
+ cpu_profiler->StartCpuProfiling(
+ v8::String::NewFromUtf8(args.GetIsolate(), ""));
}
@@ -583,7 +586,8 @@
if (args.Length() > 0)
cpu_profiler->StopCpuProfiling(args[0].As<v8::String>());
else
- cpu_profiler->StopCpuProfiling(v8::String::New(""));
+ cpu_profiler->StopCpuProfiling(
+ v8::String::NewFromUtf8(args.GetIsolate(), ""));
}
@@ -673,7 +677,7 @@
const char* name) {
for (int i = 0; i < parent->GetChildrenCount(); ++i) {
const v8::CpuProfileNode* child = parent->GetChild(i);
- v8::String::AsciiValue function_name(child->GetFunctionName());
+ v8::String::Utf8Value function_name(child->GetFunctionName());
if (strcmp(*function_name, name) == 0) return child;
}
return NULL;
@@ -692,13 +696,14 @@
v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler();
CHECK_EQ(0, profiler->GetProfileCount());
- v8::Handle<v8::Script> script_a = v8::Script::Compile(v8::String::New(
- "function a() { startProfiling(); }\n"));
+ v8::Handle<v8::Script> script_a = v8::Script::Compile(v8::String::NewFromUtf8(
+ env->GetIsolate(), "function a() { startProfiling(); }\n"));
script_a->Run();
- v8::Handle<v8::Script> script_b = v8::Script::Compile(v8::String::New(
- "function b() { a(); }\n"
- "b();\n"
- "stopProfiling();\n"));
+ v8::Handle<v8::Script> script_b =
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "function b() { a(); }\n"
+ "b();\n"
+ "stopProfiling();\n"));
script_b->Run();
CHECK_EQ(1, profiler->GetProfileCount());
const v8::CpuProfile* profile = profiler->GetCpuProfile(0);
@@ -793,19 +798,20 @@
v8::CpuProfiler* profiler = env->GetIsolate()->GetCpuProfiler();
CHECK_EQ(0, profiler->GetProfileCount());
- v8::Handle<v8::Script> script = v8::Script::Compile(v8::String::New(
- "function TryCatch() {\n"
- " try {\n"
- " startProfiling();\n"
- " } catch (e) { };\n"
- "}\n"
- "function TryFinally() {\n"
- " try {\n"
- " TryCatch();\n"
- " } finally { };\n"
- "}\n"
- "TryFinally();\n"
- "stopProfiling();"));
+ v8::Handle<v8::Script> script =
+ v8::Script::Compile(v8::String::NewFromUtf8(env->GetIsolate(),
+ "function TryCatch() {\n"
+ " try {\n"
+ " startProfiling();\n"
+ " } catch (e) { };\n"
+ "}\n"
+ "function TryFinally() {\n"
+ " try {\n"
+ " TryCatch();\n"
+ " } finally { };\n"
+ "}\n"
+ "TryFinally();\n"
+ "stopProfiling();"));
script->Run();
CHECK_EQ(1, profiler->GetProfileCount());
const v8::CpuProfile* profile = profiler->GetCpuProfile(0);
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
index 4132d2d..c01a688 100644
--- a/test/cctest/test-serialize.cc
+++ b/test/cctest/test-serialize.cc
@@ -347,7 +347,7 @@
env->Enter();
const char* c_source = "\"1234\".length";
- v8::Local<v8::String> source = v8::String::New(c_source);
+ v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, c_source);
v8::Local<v8::Script> script = v8::Script::Compile(source);
CHECK_EQ(4, script->Run()->Int32Value());
}
@@ -365,7 +365,7 @@
env->Enter();
const char* c_source = "\"1234\".length";
- v8::Local<v8::String> source = v8::String::New(c_source);
+ v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, c_source);
v8::Local<v8::Script> script = v8::Script::Compile(source);
CHECK_EQ(4, script->Run()->Int32Value());
}
@@ -402,7 +402,7 @@
Object* raw_foo;
{
v8::HandleScope handle_scope(v8_isolate);
- v8::Local<v8::String> foo = v8::String::New("foo");
+ v8::Local<v8::String> foo = v8::String::NewFromUtf8(v8_isolate, "foo");
ASSERT(!foo.IsEmpty());
raw_foo = *(v8::Utils::OpenHandle(*foo));
}
@@ -415,7 +415,7 @@
v8::HandleScope handle_scope(v8_isolate);
v8::Local<v8::Context>::New(v8_isolate, env)->Exit();
}
- env.Dispose();
+ env.Reset();
FileByteSink startup_sink(startup_name.start());
StartupSerializer startup_serializer(isolate, &startup_sink);
@@ -562,7 +562,7 @@
i::Object* raw_context = *v8::Utils::OpenPersistent(env);
- env.Dispose();
+ env.Reset();
FileByteSink startup_sink(startup_name.start());
StartupSerializer startup_serializer(isolate, &startup_sink);
diff --git a/test/cctest/test-strings.cc b/test/cctest/test-strings.cc
index 333e2a6..d0eabe3 100644
--- a/test/cctest/test-strings.cc
+++ b/test/cctest/test-strings.cc
@@ -889,9 +889,9 @@
v8::HandleScope handle_scope(CcTest::isolate());
// A simple ascii string
const char* ascii_string = "abcdef12345";
- int len =
- v8::String::New(ascii_string,
- StrLength(ascii_string))->Utf8Length();
+ int len = v8::String::NewFromUtf8(CcTest::isolate(), ascii_string,
+ v8::String::kNormalString,
+ StrLength(ascii_string))->Utf8Length();
CHECK_EQ(StrLength(ascii_string), len);
// A mixed ascii and non-ascii string
// U+02E4 -> CB A4
@@ -906,7 +906,8 @@
// The number of bytes expected to be written for each length
const int lengths[12] = {0, 0, 2, 3, 3, 3, 6, 7, 7, 7, 10, 11};
const int char_lengths[12] = {0, 0, 1, 2, 2, 2, 3, 4, 4, 4, 5, 5};
- v8::Handle<v8::String> mixed = v8::String::New(mixed_string, 5);
+ v8::Handle<v8::String> mixed = v8::String::NewFromTwoByte(
+ CcTest::isolate(), mixed_string, v8::String::kNormalString, 5);
CHECK_EQ(10, mixed->Utf8Length());
// Try encoding the string with all capacities
char buffer[11];
@@ -1083,8 +1084,8 @@
const char* line;
for (int i = 0; (line = lines[i]); i++) {
printf("%s\n", line);
- v8::Local<v8::Value> result =
- v8::Script::Compile(v8::String::New(line))->Run();
+ v8::Local<v8::Value> result = v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(), line))->Run();
CHECK_EQ(results[i]->IsUndefined(), result->IsUndefined());
CHECK_EQ(results[i]->IsNumber(), result->IsNumber());
if (result->IsNumber()) {
@@ -1230,8 +1231,8 @@
v8::HandleScope scope(CcTest::isolate());
LocalContext context;
v8::V8::IgnoreOutOfMemoryException();
- v8::Local<v8::Script> script =
- v8::Script::Compile(v8::String::New(join_causing_out_of_memory));
+ v8::Local<v8::Script> script = v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(), join_causing_out_of_memory));
v8::Local<v8::Value> result = script->Run();
// Check for out of memory state.
diff --git a/test/cctest/test-thread-termination.cc b/test/cctest/test-thread-termination.cc
index 13f5940..94c739f 100644
--- a/test/cctest/test-thread-termination.cc
+++ b/test/cctest/test-thread-termination.cc
@@ -51,8 +51,8 @@
void Loop(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
- v8::Handle<v8::String> source =
- v8::String::New("try { doloop(); fail(); } catch(e) { fail(); }");
+ v8::Handle<v8::String> source = v8::String::NewFromUtf8(
+ args.GetIsolate(), "try { doloop(); fail(); } catch(e) { fail(); }");
v8::Handle<v8::Value> result = v8::Script::Compile(source)->Run();
CHECK(result.IsEmpty());
CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
@@ -62,19 +62,20 @@
void DoLoop(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
- v8::Script::Compile(v8::String::New("function f() {"
- " var term = true;"
- " try {"
- " while(true) {"
- " if (term) terminate();"
- " term = false;"
- " }"
- " fail();"
- " } catch(e) {"
- " fail();"
- " }"
- "}"
- "f()"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
+ "function f() {"
+ " var term = true;"
+ " try {"
+ " while(true) {"
+ " if (term) terminate();"
+ " term = false;"
+ " }"
+ " fail();"
+ " } catch(e) {"
+ " fail();"
+ " }"
+ "}"
+ "f()"))->Run();
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
@@ -86,11 +87,12 @@
void DoLoopNoCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
- v8::Script::Compile(v8::String::New("var term = true;"
- "while(true) {"
- " if (term) terminate();"
- " term = false;"
- "}"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
+ "var term = true;"
+ "while(true) {"
+ " if (term) terminate();"
+ " term = false;"
+ "}"))->Run();
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
@@ -100,14 +102,18 @@
v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate(
+ v8::Isolate* isolate,
v8::FunctionCallback terminate,
v8::FunctionCallback doloop) {
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
- global->Set(v8::String::New("terminate"),
+ global->Set(v8::String::NewFromUtf8(isolate, "terminate"),
v8::FunctionTemplate::New(terminate));
- global->Set(v8::String::New("fail"), v8::FunctionTemplate::New(Fail));
- global->Set(v8::String::New("loop"), v8::FunctionTemplate::New(Loop));
- global->Set(v8::String::New("doloop"), v8::FunctionTemplate::New(doloop));
+ global->Set(v8::String::NewFromUtf8(isolate, "fail"),
+ v8::FunctionTemplate::New(Fail));
+ global->Set(v8::String::NewFromUtf8(isolate, "loop"),
+ v8::FunctionTemplate::New(Loop));
+ global->Set(v8::String::NewFromUtf8(isolate, "doloop"),
+ v8::FunctionTemplate::New(doloop));
return global;
}
@@ -117,14 +123,14 @@
TEST(TerminateOnlyV8ThreadFromThreadItself) {
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global =
- CreateGlobalTemplate(TerminateCurrentThread, DoLoop);
+ CreateGlobalTemplate(CcTest::isolate(), TerminateCurrentThread, DoLoop);
v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Run a loop that will be infinite if thread termination does not work.
- v8::Handle<v8::String> source =
- v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
+ v8::Handle<v8::String> source = v8::String::NewFromUtf8(
+ CcTest::isolate(), "try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run();
// Test that we can run the code again after thread termination.
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
@@ -136,15 +142,15 @@
// itself in a loop that performs no calls.
TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) {
v8::HandleScope scope(CcTest::isolate());
- v8::Handle<v8::ObjectTemplate> global =
- CreateGlobalTemplate(TerminateCurrentThread, DoLoopNoCall);
+ v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(
+ CcTest::isolate(), TerminateCurrentThread, DoLoopNoCall);
v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Run a loop that will be infinite if thread termination does not work.
- v8::Handle<v8::String> source =
- v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
+ v8::Handle<v8::String> source = v8::String::NewFromUtf8(
+ CcTest::isolate(), "try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run();
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Test that we can run the code again after thread termination.
@@ -176,14 +182,15 @@
thread.Start();
v8::HandleScope scope(CcTest::isolate());
- v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(Signal, DoLoop);
+ v8::Handle<v8::ObjectTemplate> global =
+ CreateGlobalTemplate(CcTest::isolate(), Signal, DoLoop);
v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Run a loop that will be infinite if thread termination does not work.
- v8::Handle<v8::String> source =
- v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
+ v8::Handle<v8::String> source = v8::String::NewFromUtf8(
+ CcTest::isolate(), "try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run();
thread.Join();
@@ -202,7 +209,8 @@
return;
}
v8::Local<v8::Object> result = v8::Object::New();
- result->Set(v8::String::New("x"), v8::Integer::New(42));
+ result->Set(v8::String::NewFromUtf8(args.GetIsolate(), "x"),
+ v8::Integer::New(42));
args.GetReturnValue().Set(result);
}
@@ -210,17 +218,19 @@
void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
- v8::Script::Compile(v8::String::New("function f() {"
- " try {"
- " while(true) {"
- " terminate_or_return_object().x;"
- " }"
- " fail();"
- " } catch(e) {"
- " fail();"
- " }"
- "}"
- "f()"))->Run();
+ v8::Script::Compile(
+ v8::String::NewFromUtf8(args.GetIsolate(),
+ "function f() {"
+ " try {"
+ " while(true) {"
+ " terminate_or_return_object().x;"
+ " }"
+ " fail();"
+ " } catch(e) {"
+ " fail();"
+ " }"
+ "}"
+ "f()"))->Run();
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
@@ -234,10 +244,12 @@
TEST(TerminateLoadICException) {
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
- global->Set(v8::String::New("terminate_or_return_object"),
- v8::FunctionTemplate::New(TerminateOrReturnObject));
- global->Set(v8::String::New("fail"), v8::FunctionTemplate::New(Fail));
- global->Set(v8::String::New("loop"),
+ global->Set(
+ v8::String::NewFromUtf8(CcTest::isolate(), "terminate_or_return_object"),
+ v8::FunctionTemplate::New(TerminateOrReturnObject));
+ global->Set(v8::String::NewFromUtf8(CcTest::isolate(), "fail"),
+ v8::FunctionTemplate::New(Fail));
+ global->Set(v8::String::NewFromUtf8(CcTest::isolate(), "loop"),
v8::FunctionTemplate::New(LoopGetProperty));
v8::Handle<v8::Context> context =
@@ -245,8 +257,8 @@
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Run a loop that will be infinite if thread termination does not work.
- v8::Handle<v8::String> source =
- v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
+ v8::Handle<v8::String> source = v8::String::NewFromUtf8(
+ CcTest::isolate(), "try { loop(); fail(); } catch(e) { fail(); }");
call_count = 0;
v8::Script::Compile(source)->Run();
// Test that we can run the code again after thread termination.
@@ -259,25 +271,28 @@
void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
- v8::Script::Compile(v8::String::New("function f() {"
- " var term = true;"
- " try {"
- " while(true) {"
- " if (term) terminate();"
- " term = false;"
- " }"
- " fail();"
- " } catch(e) {"
- " fail();"
- " }"
- "}"
- "f()"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
+ "function f() {"
+ " var term = true;"
+ " try {"
+ " while(true) {"
+ " if (term) terminate();"
+ " term = false;"
+ " }"
+ " fail();"
+ " } catch(e) {"
+ " fail();"
+ " }"
+ "}"
+ "f()"))->Run();
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
- v8::Script::Compile(v8::String::New("function f() { fail(); } f()"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
+ "function f() { fail(); } f()"))
+ ->Run();
}
@@ -285,31 +300,36 @@
// (has not yet unwound the 0-level JS frame) does not crash.
TEST(TerminateAndReenterFromThreadItself) {
v8::HandleScope scope(CcTest::isolate());
- v8::Handle<v8::ObjectTemplate> global =
- CreateGlobalTemplate(TerminateCurrentThread, ReenterAfterTermination);
+ v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(
+ CcTest::isolate(), TerminateCurrentThread, ReenterAfterTermination);
v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
- v8::Handle<v8::String> source =
- v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
+ v8::Handle<v8::String> source = v8::String::NewFromUtf8(
+ CcTest::isolate(), "try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run();
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Check we can run JS again after termination.
- CHECK(v8::Script::Compile(v8::String::New("function f() { return true; }"
- "f()"))->Run()->IsTrue());
+ CHECK(v8::Script::Compile(
+ v8::String::NewFromUtf8(CcTest::isolate(),
+ "function f() { return true; }"
+ "f()"))
+ ->Run()
+ ->IsTrue());
}
void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating());
- v8::Script::Compile(v8::String::New("var term = true;"
- "while(true) {"
- " if (term) terminate();"
- " term = false;"
- "}"
- "fail();"))->Run();
+ v8::Script::Compile(v8::String::NewFromUtf8(args.GetIsolate(),
+ "var term = true;"
+ "while(true) {"
+ " if (term) terminate();"
+ " term = false;"
+ "}"
+ "fail();"))->Run();
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
@@ -326,13 +346,13 @@
TEST(TerminateCancelTerminateFromThreadItself) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
- v8::Handle<v8::ObjectTemplate> global =
- CreateGlobalTemplate(TerminateCurrentThread, DoLoopCancelTerminate);
+ v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(
+ isolate, TerminateCurrentThread, DoLoopCancelTerminate);
v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
- v8::Handle<v8::String> source =
- v8::String::New("try { doloop(); } catch(e) { fail(); } 'completed';");
+ v8::Handle<v8::String> source = v8::String::NewFromUtf8(
+ isolate, "try { doloop(); } catch(e) { fail(); } 'completed';");
// Check that execution completed with correct return value.
CHECK(v8::Script::Compile(source)->Run()->Equals(v8_str("completed")));
}
diff --git a/test/cctest/test-threads.cc b/test/cctest/test-threads.cc
index c43c420..41f8b2d 100644
--- a/test/cctest/test-threads.cc
+++ b/test/cctest/test-threads.cc
@@ -58,7 +58,8 @@
// Fill String.search cache.
v8::Handle<v8::Script> script = v8::Script::Compile(
- v8::String::New(
+ v8::String::NewFromUtf8(
+ isolate,
"for (var i = 0; i < 3; i++) {"
" var result = \"a\".search(\"a\");"
" if (result != 0) throw \"result: \" + result + \" @\" + i;"
diff --git a/test/cctest/test-unbound-queue.cc b/test/cctest/test-unbound-queue.cc
index 6d02fff..dd9b9c1 100644
--- a/test/cctest/test-unbound-queue.cc
+++ b/test/cctest/test-unbound-queue.cc
@@ -74,4 +74,3 @@
}
CHECK(cq.IsEmpty());
}
-
diff --git a/test/cctest/test-unique.cc b/test/cctest/test-unique.cc
index 0936908..ad14ff1 100644
--- a/test/cctest/test-unique.cc
+++ b/test/cctest/test-unique.cc
@@ -546,4 +546,3 @@
}
}
}
-
diff --git a/test/cctest/test-weakmaps.cc b/test/cctest/test-weakmaps.cc
index 175ca28..8cb0aab 100644
--- a/test/cctest/test-weakmaps.cc
+++ b/test/cctest/test-weakmaps.cc
@@ -69,7 +69,7 @@
void* id) {
ASSERT(id == reinterpret_cast<void*>(1234));
NumberOfWeakCalls++;
- handle->Dispose();
+ handle->Reset();
}
diff --git a/test/cctest/test-weaksets.cc b/test/cctest/test-weaksets.cc
index f7cc73c..ee75744 100644
--- a/test/cctest/test-weaksets.cc
+++ b/test/cctest/test-weaksets.cc
@@ -69,7 +69,7 @@
void* id) {
ASSERT(id == reinterpret_cast<void*>(1234));
NumberOfWeakCalls++;
- handle->Dispose();
+ handle->Reset();
}
diff --git a/test/intl/collator/sr-sort.js b/test/intl/collator/sr-sort.js
index 53c784c..b7e6f30 100644
--- a/test/intl/collator/sr-sort.js
+++ b/test/intl/collator/sr-sort.js
@@ -43,4 +43,3 @@
assertEquals('ћук', result[7]);
assertEquals('чука', result[8]);
assertEquals('џак', result[9]);
-
diff --git a/test/intl/overrides/caching.js b/test/intl/overrides/caching.js
index 5ff3c39..abcd640 100644
--- a/test/intl/overrides/caching.js
+++ b/test/intl/overrides/caching.js
@@ -57,4 +57,3 @@
assertTrue(collatorTime < cachedTime);
// Non-cached time is much slower, measured to 12.5 times.
assertTrue(cachedTime < nonCachedTime);
-
diff --git a/test/message/isvar.js b/test/message/isvar.js
index 67793a0..fedf9d5 100644
--- a/test/message/isvar.js
+++ b/test/message/isvar.js
@@ -28,4 +28,4 @@
// Flags: --allow-natives-syntax
var x;
%IS_VAR(x);
-%IS_VAR(x+x);
\ No newline at end of file
+%IS_VAR(x+x);
diff --git a/test/message/paren_in_arg_string.js b/test/message/paren_in_arg_string.js
index bab762a..83ba7c0 100644
--- a/test/message/paren_in_arg_string.js
+++ b/test/message/paren_in_arg_string.js
@@ -26,4 +26,4 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var paren_in_arg_string_good = new Function('x', 'return;');
-var paren_in_arg_string_bad = new Function(')', 'return;');
\ No newline at end of file
+var paren_in_arg_string_bad = new Function(')', 'return;');
diff --git a/test/message/replacement-marker-as-argument.js b/test/message/replacement-marker-as-argument.js
index 9036654..22a68ec 100644
--- a/test/message/replacement-marker-as-argument.js
+++ b/test/message/replacement-marker-as-argument.js
@@ -28,4 +28,4 @@
"use strict";
var o = { get "%3" (){} };
-o["%3"] = 10;
\ No newline at end of file
+o["%3"] = 10;
diff --git a/test/message/single-function-literal.js b/test/message/single-function-literal.js
index 3720637..96d3bd6 100644
--- a/test/message/single-function-literal.js
+++ b/test/message/single-function-literal.js
@@ -29,4 +29,4 @@
var single_function_good = "(function() { return 5; })";
%CompileString(single_function_good, true);
var single_function_bad = "(function() { return 5; })();";
-%CompileString(single_function_bad, true);
\ No newline at end of file
+%CompileString(single_function_bad, true);
diff --git a/test/mjsunit/arguments-load-across-eval.js b/test/mjsunit/arguments-load-across-eval.js
index e97c113..295b62c 100644
--- a/test/mjsunit/arguments-load-across-eval.js
+++ b/test/mjsunit/arguments-load-across-eval.js
@@ -82,5 +82,3 @@
}
testShadowing(1, function() { return 2; });
-
-
diff --git a/test/mjsunit/arguments-read-and-assignment.js b/test/mjsunit/arguments-read-and-assignment.js
index c5d34bf..fba052b 100644
--- a/test/mjsunit/arguments-read-and-assignment.js
+++ b/test/mjsunit/arguments-read-and-assignment.js
@@ -161,4 +161,4 @@
var args1 = weirdargs(false, null, 40);
var res = weirdargs(true, args1, 15);
assertEquals(40, res[0], "return old args element");
-assertEquals(15, res[1], "return own args element");
\ No newline at end of file
+assertEquals(15, res[1], "return own args element");
diff --git a/test/mjsunit/arguments.js b/test/mjsunit/arguments.js
index 78b7722..56c1d72 100644
--- a/test/mjsunit/arguments.js
+++ b/test/mjsunit/arguments.js
@@ -187,4 +187,4 @@
function arg_set(x) { return (arguments[x] = 117); }
assertEquals(undefined, arg_get(0xFFFFFFFF));
assertEquals(true, arg_del(0xFFFFFFFF));
-assertEquals(117, arg_set(0xFFFFFFFF));
\ No newline at end of file
+assertEquals(117, arg_set(0xFFFFFFFF));
diff --git a/test/mjsunit/array-iteration.js b/test/mjsunit/array-iteration.js
index 033bb54..d11f984 100644
--- a/test/mjsunit/array-iteration.js
+++ b/test/mjsunit/array-iteration.js
@@ -225,4 +225,3 @@
assertEquals(2, count);
})();
-
diff --git a/test/mjsunit/array-non-smi-length.js b/test/mjsunit/array-non-smi-length.js
index 23a25ee..11277af 100644
--- a/test/mjsunit/array-non-smi-length.js
+++ b/test/mjsunit/array-non-smi-length.js
@@ -43,4 +43,3 @@
}
TestNonSmiArrayLength();
-
diff --git a/test/mjsunit/array-tostring.js b/test/mjsunit/array-tostring.js
index 6708657..5be3d50 100644
--- a/test/mjsunit/array-tostring.js
+++ b/test/mjsunit/array-tostring.js
@@ -156,4 +156,4 @@
}});
}
Number.prototype.arrayToLocaleString = Array.prototype.toLocaleString;
-assertEquals("42,42,42", (42).arrayToLocaleString());
\ No newline at end of file
+assertEquals("42,42,42", (42).arrayToLocaleString());
diff --git a/test/mjsunit/bugs/bug-1344252.js b/test/mjsunit/bugs/bug-1344252.js
index 1723834..747ce19 100644
--- a/test/mjsunit/bugs/bug-1344252.js
+++ b/test/mjsunit/bugs/bug-1344252.js
@@ -76,4 +76,3 @@
o2.z = 27;
assertEquals(27, result_z);
assertTrue(typeof o2.z == 'undefined');
-
diff --git a/test/mjsunit/bugs/bug-proto.js b/test/mjsunit/bugs/bug-proto.js
index 149088e..5638336 100644
--- a/test/mjsunit/bugs/bug-proto.js
+++ b/test/mjsunit/bugs/bug-proto.js
@@ -59,4 +59,3 @@
Realm.eval(realmB, "Realm.shared.__proto__ = {c: 3}");
assertSame(1, o.a);
assertSame(undefined, o.c);
-
diff --git a/test/mjsunit/closures.js b/test/mjsunit/closures.js
index 7c11971..5ce26ca 100644
--- a/test/mjsunit/closures.js
+++ b/test/mjsunit/closures.js
@@ -44,4 +44,3 @@
test(1);
test(42);
test(239);
-
diff --git a/test/mjsunit/compare-character.js b/test/mjsunit/compare-character.js
index cabe013..8c812ee 100644
--- a/test/mjsunit/compare-character.js
+++ b/test/mjsunit/compare-character.js
@@ -47,4 +47,3 @@
assertEquals(f < x, 'f' < x, ">r" + x);
assertEquals(f <= x, 'f' <= x, ">=r" + x);
}
-
diff --git a/test/mjsunit/compare-nan.js b/test/mjsunit/compare-nan.js
index c4f7817..a4224ff 100644
--- a/test/mjsunit/compare-nan.js
+++ b/test/mjsunit/compare-nan.js
@@ -63,4 +63,3 @@
"assertFalse(" + x + " >= NaN, '' + " + x + " + ' >= NaN');\n";
eval(program);
}
-
diff --git a/test/mjsunit/compiler/control-flow-1.js b/test/mjsunit/compiler/control-flow-1.js
index 973d9b6..ca7ad87 100644
--- a/test/mjsunit/compiler/control-flow-1.js
+++ b/test/mjsunit/compiler/control-flow-1.js
@@ -52,4 +52,4 @@
}
assertTrue(g1(0, 0));
-assertFalse(g1(0, 1));
\ No newline at end of file
+assertFalse(g1(0, 1));
diff --git a/test/mjsunit/compiler/inline-throw.js b/test/mjsunit/compiler/inline-throw.js
index e3aab39..099b9d3 100644
--- a/test/mjsunit/compiler/inline-throw.js
+++ b/test/mjsunit/compiler/inline-throw.js
@@ -66,4 +66,3 @@
} catch(e) {
assertEquals("wow", e);
}
-
diff --git a/test/mjsunit/compiler/lazy-const-lookup.js b/test/mjsunit/compiler/lazy-const-lookup.js
index b4f15a1..ff4558e 100644
--- a/test/mjsunit/compiler/lazy-const-lookup.js
+++ b/test/mjsunit/compiler/lazy-const-lookup.js
@@ -38,4 +38,3 @@
}
outer();
-
diff --git a/test/mjsunit/compiler/optimized-closures.js b/test/mjsunit/compiler/optimized-closures.js
index eaf75f8..499e4d5 100644
--- a/test/mjsunit/compiler/optimized-closures.js
+++ b/test/mjsunit/compiler/optimized-closures.js
@@ -51,7 +51,3 @@
assertEquals(42, a[0]);
assertEquals(49, a[7]);
assertEquals(-19, a[23]);
-
-
-
-
diff --git a/test/mjsunit/compiler/regress-1394.js b/test/mjsunit/compiler/regress-1394.js
index b1ce192..fbf4357 100644
--- a/test/mjsunit/compiler/regress-1394.js
+++ b/test/mjsunit/compiler/regress-1394.js
@@ -56,4 +56,3 @@
assertEquals(0, f(0));
assertEquals(1, f(1));
-
diff --git a/test/mjsunit/compiler/regress-3260426.js b/test/mjsunit/compiler/regress-3260426.js
index dfef424..457064d 100644
--- a/test/mjsunit/compiler/regress-3260426.js
+++ b/test/mjsunit/compiler/regress-3260426.js
@@ -33,4 +33,3 @@
function test() { return always_false() ? 0 : 1; }
assertEquals(1, test());
-
diff --git a/test/mjsunit/compiler/regress-closures-with-eval.js b/test/mjsunit/compiler/regress-closures-with-eval.js
index 57afb16..d95d128 100644
--- a/test/mjsunit/compiler/regress-closures-with-eval.js
+++ b/test/mjsunit/compiler/regress-closures-with-eval.js
@@ -53,4 +53,4 @@
withEval(expr, function(a) { return a; });
}
%OptimizeFunctionOnNextCall(withEval);
-withEval(expr, function(a) { return a; });
\ No newline at end of file
+withEval(expr, function(a) { return a; });
diff --git a/test/mjsunit/compiler/regress-inline-callfunctionstub.js b/test/mjsunit/compiler/regress-inline-callfunctionstub.js
index a39d26d..3365534 100644
--- a/test/mjsunit/compiler/regress-inline-callfunctionstub.js
+++ b/test/mjsunit/compiler/regress-inline-callfunctionstub.js
@@ -43,4 +43,3 @@
main(o.g);
%OptimizeFunctionOnNextCall(main);
main(o.g);
-
diff --git a/test/mjsunit/compiler/regress-toint32.js b/test/mjsunit/compiler/regress-toint32.js
index 54c2f76..75892d4 100644
--- a/test/mjsunit/compiler/regress-toint32.js
+++ b/test/mjsunit/compiler/regress-toint32.js
@@ -42,4 +42,3 @@
assertEquals(G, f(G));
%OptimizeFunctionOnNextCall(f);
assertEquals(G, f(G));
-
diff --git a/test/mjsunit/compiler/rotate.js b/test/mjsunit/compiler/rotate.js
index 2f4bc5a..1c81e49 100644
--- a/test/mjsunit/compiler/rotate.js
+++ b/test/mjsunit/compiler/rotate.js
@@ -306,5 +306,3 @@
assertEquals(ROR4(0xFFFFFFFF, 40), ROR4_sa40(0xFFFFFFFF));
%OptimizeFunctionOnNextCall(ROR4_sa40);
assertEquals(ROR4(0xFFFFFFFF, 40), ROR4_sa40(0xFFFFFFFF));
-
-
diff --git a/test/mjsunit/const-declaration.js b/test/mjsunit/const-declaration.js
index 48c0cf2..e7bb678 100644
--- a/test/mjsunit/const-declaration.js
+++ b/test/mjsunit/const-declaration.js
@@ -169,4 +169,3 @@
}
f("const x = 0;");
})();
-
diff --git a/test/mjsunit/cyclic-array-to-string.js b/test/mjsunit/cyclic-array-to-string.js
index 0a2d6e3..ad77743 100644
--- a/test/mjsunit/cyclic-array-to-string.js
+++ b/test/mjsunit/cyclic-array-to-string.js
@@ -62,4 +62,3 @@
assertEquals("", a1.toString());
assertEquals("", a1.toLocaleString());
assertEquals("", a1.join());
-
diff --git a/test/mjsunit/debug-breakpoints.js b/test/mjsunit/debug-breakpoints.js
index 148acfc..a04fac5 100644
--- a/test/mjsunit/debug-breakpoints.js
+++ b/test/mjsunit/debug-breakpoints.js
@@ -222,4 +222,3 @@
Debug.BreakPositionAlignment.BreakPosition).indexOf(scenario[i][1]) > 0);
Debug.clearBreakPoint(bp1);
}
-
diff --git a/test/mjsunit/debug-constructor.js b/test/mjsunit/debug-constructor.js
index 38028aa..6d4e7f3 100644
--- a/test/mjsunit/debug-constructor.js
+++ b/test/mjsunit/debug-constructor.js
@@ -75,4 +75,4 @@
assertEquals("bbccdcb", call_graph);
// Get rid of the debug event listener.
-Debug.setListener(null);
\ No newline at end of file
+Debug.setListener(null);
diff --git a/test/mjsunit/debug-evaluate-const.js b/test/mjsunit/debug-evaluate-const.js
index cb9695b..7fad483 100644
--- a/test/mjsunit/debug-evaluate-const.js
+++ b/test/mjsunit/debug-evaluate-const.js
@@ -118,4 +118,3 @@
assertFalse(exception, "exception in listener")
assertTrue(listenerComplete);
-
diff --git a/test/mjsunit/debug-function-scopes.js b/test/mjsunit/debug-function-scopes.js
index 4262b95..b51e8b4 100644
--- a/test/mjsunit/debug-function-scopes.js
+++ b/test/mjsunit/debug-function-scopes.js
@@ -159,4 +159,3 @@
// This getter is known to be implemented as closure.
CheckNoScopeVisible(new Error().__lookupGetter__("stack"));
-
diff --git a/test/mjsunit/debug-ignore-breakpoints.js b/test/mjsunit/debug-ignore-breakpoints.js
index 96c6044..3cb283b 100644
--- a/test/mjsunit/debug-ignore-breakpoints.js
+++ b/test/mjsunit/debug-ignore-breakpoints.js
@@ -86,4 +86,3 @@
assertEquals(5, break_point_hit_count);
f();
assertEquals(6, break_point_hit_count);
-
diff --git a/test/mjsunit/debug-liveedit-3.js b/test/mjsunit/debug-liveedit-3.js
index b210657..023c94e 100644
--- a/test/mjsunit/debug-liveedit-3.js
+++ b/test/mjsunit/debug-liveedit-3.js
@@ -66,5 +66,3 @@
var z100 = Factory(100)();
assertEquals(102, z100());
-
-
diff --git a/test/mjsunit/debug-liveedit-check-stack.js b/test/mjsunit/debug-liveedit-check-stack.js
index df9e1cf..6948a70 100644
--- a/test/mjsunit/debug-liveedit-check-stack.js
+++ b/test/mjsunit/debug-liveedit-check-stack.js
@@ -138,4 +138,3 @@
exception_holder = {};
assertEquals("Cat", test.ChooseAnimal(WrapInNativeCall(WrapInDebuggerCall(WrapInCatcher(test.ScriptChanger, exception_holder)))));
assertTrue(!!exception_holder[0]);
-
diff --git a/test/mjsunit/debug-liveedit-compile-error.js b/test/mjsunit/debug-liveedit-compile-error.js
index 2fd6aed..99ac031 100644
--- a/test/mjsunit/debug-liveedit-compile-error.js
+++ b/test/mjsunit/debug-liveedit-compile-error.js
@@ -56,5 +56,3 @@
caught_exception.details.syntaxErrorMessage);
assertEquals(2, caught_exception.details.position.start.line);
-
-
diff --git a/test/mjsunit/debug-liveedit-diff.js b/test/mjsunit/debug-liveedit-diff.js
index 0d26a30..2fd2497 100644
--- a/test/mjsunit/debug-liveedit-diff.js
+++ b/test/mjsunit/debug-liveedit-diff.js
@@ -110,4 +110,3 @@
"yesterday\nall\nmy\ntroubles\nseemed\nso\nfar\naway",
"yesterday\nall\nmy\ntroubles\nseemed\nso\n"
);
-
diff --git a/test/mjsunit/debug-liveedit-utils.js b/test/mjsunit/debug-liveedit-utils.js
index c892ec9..8521a6d 100644
--- a/test/mjsunit/debug-liveedit-utils.js
+++ b/test/mjsunit/debug-liveedit-utils.js
@@ -93,5 +93,3 @@
assertEquals(2010, MultiChunkTranslator.Translate(60, Return2010));
assertEquals(70, MultiChunkTranslator.Translate(70));
assertEquals(75, MultiChunkTranslator.Translate(75));
-
-
diff --git a/test/mjsunit/debug-mirror-cache.js b/test/mjsunit/debug-mirror-cache.js
index 5b85306..07aaf88 100644
--- a/test/mjsunit/debug-mirror-cache.js
+++ b/test/mjsunit/debug-mirror-cache.js
@@ -82,4 +82,3 @@
assertEquals([], listenerExceptions, "Exception in listener");
// Make sure that the debug event listener vas invoked.
assertEquals(2, listenerCallCount, "Listener not called");
-
diff --git a/test/mjsunit/debug-setbreakpoint.js b/test/mjsunit/debug-setbreakpoint.js
index 8531c4e..bc23021 100644
--- a/test/mjsunit/debug-setbreakpoint.js
+++ b/test/mjsunit/debug-setbreakpoint.js
@@ -214,4 +214,3 @@
// moment. Since there's no way of simply getting the pointer to the function,
// we run this code while the script function is being activated on stack.
eval('SetBreakpointInI1Script()\nfunction i1(){}\n\n\n\nfunction i2(){}\n');
-
diff --git a/test/mjsunit/debug-stepin-positions.js b/test/mjsunit/debug-stepin-positions.js
index e6d8204..722df53 100644
--- a/test/mjsunit/debug-stepin-positions.js
+++ b/test/mjsunit/debug-stepin-positions.js
@@ -221,5 +221,3 @@
};
})(Object);
TestCaseWithDebugger(fun);
-
-
diff --git a/test/mjsunit/debug-stepout-scope-part1.js b/test/mjsunit/debug-stepout-scope-part1.js
index f2f9d91..f49b1a0 100644
--- a/test/mjsunit/debug-stepout-scope-part1.js
+++ b/test/mjsunit/debug-stepout-scope-part1.js
@@ -187,4 +187,4 @@
// With block as the last(!) statement in global code.
-with ({}) { debugger; }
\ No newline at end of file
+with ({}) { debugger; }
diff --git a/test/mjsunit/elide-double-hole-check-9.js b/test/mjsunit/elide-double-hole-check-9.js
index 88bbc7e..bbcbfb2 100644
--- a/test/mjsunit/elide-double-hole-check-9.js
+++ b/test/mjsunit/elide-double-hole-check-9.js
@@ -46,4 +46,3 @@
assertEquals(0.5, f(arr, 0));
do_set = true;
assertEquals(2, f(arr, 1));
-
diff --git a/test/mjsunit/enumeration-order.js b/test/mjsunit/enumeration-order.js
index a328121..70942ee 100644
--- a/test/mjsunit/enumeration-order.js
+++ b/test/mjsunit/enumeration-order.js
@@ -103,7 +103,3 @@
var actual = [];
for (var p in o) actual.push(p);
assertArrayEquals(expected, actual);
-
-
-
-
diff --git a/test/mjsunit/error-accessors.js b/test/mjsunit/error-accessors.js
index 9581050..cdaf080 100644
--- a/test/mjsunit/error-accessors.js
+++ b/test/mjsunit/error-accessors.js
@@ -51,4 +51,3 @@
o.message = "another message";
assertEquals("another message", o.message);
assertEquals("x is not defined", error2.message);
-
diff --git a/test/mjsunit/eval-stack-trace.js b/test/mjsunit/eval-stack-trace.js
index d83b84c..f95e50f 100644
--- a/test/mjsunit/eval-stack-trace.js
+++ b/test/mjsunit/eval-stack-trace.js
@@ -201,4 +201,3 @@
[true, false].verifyUndefined(frames, "getFileName");
["eval at <anonymous> ("].verifyContains(frames, "getEvalOrigin");
}
-
diff --git a/test/mjsunit/extra-arguments.js b/test/mjsunit/extra-arguments.js
index 186277a..2906367 100644
--- a/test/mjsunit/extra-arguments.js
+++ b/test/mjsunit/extra-arguments.js
@@ -50,5 +50,3 @@
}
assertEquals(expected, f.apply(null, array), String(i));
}
-
-
diff --git a/test/mjsunit/fast-array-length.js b/test/mjsunit/fast-array-length.js
index 42f2c38..3917d97 100644
--- a/test/mjsunit/fast-array-length.js
+++ b/test/mjsunit/fast-array-length.js
@@ -34,4 +34,3 @@
assertTrue(%HasFastSmiElements(a));
a.length = (1 << 30);
assertFalse(%HasFastSmiElements(a));
-
diff --git a/test/mjsunit/fast-literal.js b/test/mjsunit/fast-literal.js
index 8e53244..4fd92c4 100644
--- a/test/mjsunit/fast-literal.js
+++ b/test/mjsunit/fast-literal.js
@@ -37,6 +37,3 @@
for (var i=0; i<50; i++) {
f();
}
-
-
-
diff --git a/test/mjsunit/fun-name.js b/test/mjsunit/fun-name.js
index 676daaa..1688438 100644
--- a/test/mjsunit/fun-name.js
+++ b/test/mjsunit/fun-name.js
@@ -31,4 +31,3 @@
assertEquals('function(){}', strip((function () { }).toString()));
assertEquals('functionanonymous(){}', strip(new Function().toString()));
-
diff --git a/test/mjsunit/function.js b/test/mjsunit/function.js
index b5e83db..5c33762 100644
--- a/test/mjsunit/function.js
+++ b/test/mjsunit/function.js
@@ -80,4 +80,3 @@
f = new Function(x, y, z);
assertEquals(25, f(5, 5));
assertEquals(42, f(2, 21));
-
diff --git a/test/mjsunit/get-prototype-of.js b/test/mjsunit/get-prototype-of.js
index 6475bde..c2a492a 100644
--- a/test/mjsunit/get-prototype-of.js
+++ b/test/mjsunit/get-prototype-of.js
@@ -65,4 +65,3 @@
GetPrototypeOfObject({x:5});
GetPrototypeOfObject(F);
GetPrototypeOfObject(RegExp);
-
diff --git a/test/mjsunit/getter-in-value-prototype.js b/test/mjsunit/getter-in-value-prototype.js
index abe2cb1..8357106 100644
--- a/test/mjsunit/getter-in-value-prototype.js
+++ b/test/mjsunit/getter-in-value-prototype.js
@@ -32,4 +32,3 @@
String.prototype.__defineGetter__('x', function() { return this; });
assertEquals(Object('asdf'), 'asdf'.x);
-
diff --git a/test/mjsunit/global-load-from-eval-in-with.js b/test/mjsunit/global-load-from-eval-in-with.js
index d733f6c..a41ad7e 100644
--- a/test/mjsunit/global-load-from-eval-in-with.js
+++ b/test/mjsunit/global-load-from-eval-in-with.js
@@ -56,4 +56,3 @@
// in the eval scopes. Deeper nesting this time.
test({ x: 42 }, "function f() { function g() { eval('1'); assertEquals(42, x) }; g() }; f();");
test({ y: 42 }, "function f() { function g() { eval('1'); assertEquals(27, x) }; g() }; f();");
-
diff --git a/test/mjsunit/global-load-from-nested-eval.js b/test/mjsunit/global-load-from-nested-eval.js
index 3c7ff75..9c9b015 100644
--- a/test/mjsunit/global-load-from-nested-eval.js
+++ b/test/mjsunit/global-load-from-nested-eval.js
@@ -59,8 +59,3 @@
eval('eval(' + source +')');
}
testEvalDontShadow('assertEquals(42, x)');
-
-
-
-
-
diff --git a/test/mjsunit/harmony/array-find.js b/test/mjsunit/harmony/array-find.js
index 906c9cd..9f5750e 100644
--- a/test/mjsunit/harmony/array-find.js
+++ b/test/mjsunit/harmony/array-find.js
@@ -277,4 +277,4 @@
assertThrows('Array.prototype.find.apply({}, "", [])', TypeError);
assertThrows('Array.prototype.find.apply({}, {}, [])', TypeError);
assertThrows('Array.prototype.find.apply({}, [], [])', TypeError);
-assertThrows('Array.prototype.find.apply({}, /\d+/, [])', TypeError);
\ No newline at end of file
+assertThrows('Array.prototype.find.apply({}, /\d+/, [])', TypeError);
diff --git a/test/mjsunit/harmony/array-findindex.js b/test/mjsunit/harmony/array-findindex.js
index 928cad7..a33849d 100644
--- a/test/mjsunit/harmony/array-findindex.js
+++ b/test/mjsunit/harmony/array-findindex.js
@@ -277,4 +277,4 @@
assertThrows('Array.prototype.findIndex.apply({}, "", [])', TypeError);
assertThrows('Array.prototype.findIndex.apply({}, {}, [])', TypeError);
assertThrows('Array.prototype.findIndex.apply({}, [], [])', TypeError);
-assertThrows('Array.prototype.findIndex.apply({}, /\d+/, [])', TypeError);
\ No newline at end of file
+assertThrows('Array.prototype.findIndex.apply({}, /\d+/, [])', TypeError);
diff --git a/test/mjsunit/harmony/collections.js b/test/mjsunit/harmony/collections.js
index 174d3d1..04a5cdc 100644
--- a/test/mjsunit/harmony/collections.js
+++ b/test/mjsunit/harmony/collections.js
@@ -483,4 +483,4 @@
assertTrue(w.has(k));
w.clear();
assertFalse(w.has(k));
-})();
\ No newline at end of file
+})();
diff --git a/test/mjsunit/harmony/string-repeat.js b/test/mjsunit/harmony/string-repeat.js
index 182e5c0..761089b 100644
--- a/test/mjsunit/harmony/string-repeat.js
+++ b/test/mjsunit/harmony/string-repeat.js
@@ -71,4 +71,4 @@
repeat : String.prototype.repeat
};
assertEquals("abc", myobj.repeat(1));
-assertEquals("abcabc", myobj.repeat(2));
\ No newline at end of file
+assertEquals("abcabc", myobj.repeat(2));
diff --git a/test/mjsunit/large-object-literal.js b/test/mjsunit/large-object-literal.js
index 70a2769..47ba56e 100644
--- a/test/mjsunit/large-object-literal.js
+++ b/test/mjsunit/large-object-literal.js
@@ -53,4 +53,3 @@
for (var i = 0; i < sizes.length; i++) {
testLiteral(sizes[i]);
}
-
diff --git a/test/mjsunit/local-load-from-eval.js b/test/mjsunit/local-load-from-eval.js
index 0fdac9a..e07cd0d 100644
--- a/test/mjsunit/local-load-from-eval.js
+++ b/test/mjsunit/local-load-from-eval.js
@@ -36,4 +36,3 @@
test("(function() { assertEquals(27, x) })();");
test("(function() { var y = 42; eval('1'); assertEquals(42, y); })();");
test("(function() { var y = 42; eval('var y = 2; var z = 2;'); assertEquals(2, y); })();");
-
diff --git a/test/mjsunit/math-pow.js b/test/mjsunit/math-pow.js
index fb5f8a1..ffbf418 100644
--- a/test/mjsunit/math-pow.js
+++ b/test/mjsunit/math-pow.js
@@ -170,4 +170,4 @@
test();
test();
%OptimizeFunctionOnNextCall(test);
-test();
\ No newline at end of file
+test();
diff --git a/test/mjsunit/math-round.js b/test/mjsunit/math-round.js
index 102c970..7b87c07 100644
--- a/test/mjsunit/math-round.js
+++ b/test/mjsunit/math-round.js
@@ -170,5 +170,3 @@
testRound(min_smi31 + 1, min_smi31 + 0.5);
testRound(min_smi32, min_smi32 - 0.5);
testRound(min_smi32 + 1, min_smi32 + 0.5);
-
-
diff --git a/test/mjsunit/math-sqrt.js b/test/mjsunit/math-sqrt.js
index 43fbf6b..d5de2e9 100644
--- a/test/mjsunit/math-sqrt.js
+++ b/test/mjsunit/math-sqrt.js
@@ -50,4 +50,3 @@
test(Infinity, Infinity);
// -Infinity is smaller than 0 so it should return NaN
test(NaN, -Infinity);
-
diff --git a/test/mjsunit/mirror-boolean.js b/test/mjsunit/mirror-boolean.js
index 311c781..bbcec73 100644
--- a/test/mjsunit/mirror-boolean.js
+++ b/test/mjsunit/mirror-boolean.js
@@ -56,4 +56,4 @@
// Test all boolean values.
testBooleanMirror(true);
-testBooleanMirror(false);
\ No newline at end of file
+testBooleanMirror(false);
diff --git a/test/mjsunit/mirror-undefined.js b/test/mjsunit/mirror-undefined.js
index 7f63239..1d54b51 100644
--- a/test/mjsunit/mirror-undefined.js
+++ b/test/mjsunit/mirror-undefined.js
@@ -47,4 +47,4 @@
// Parse JSON representation and check.
var fromJSON = eval('(' + json + ')');
-assertEquals('undefined', fromJSON.type);
\ No newline at end of file
+assertEquals('undefined', fromJSON.type);
diff --git a/test/mjsunit/mjsunit.js b/test/mjsunit/mjsunit.js
index e5fb6c2..5f03774 100644
--- a/test/mjsunit/mjsunit.js
+++ b/test/mjsunit/mjsunit.js
@@ -393,4 +393,3 @@
}
})();
-
diff --git a/test/mjsunit/mul-exhaustive-part6.js b/test/mjsunit/mul-exhaustive-part6.js
index 91cb798..fb2b2ce 100644
--- a/test/mjsunit/mul-exhaustive-part6.js
+++ b/test/mjsunit/mul-exhaustive-part6.js
@@ -551,4 +551,4 @@
f(562949903089665, 16777215);
f(562949936644096, 16777216);
f(562949970198527, 16777217);
-f(1125899839733761, 33554431);
\ No newline at end of file
+f(1125899839733761, 33554431);
diff --git a/test/mjsunit/nans.js b/test/mjsunit/nans.js
index d212afd..987ad6e 100644
--- a/test/mjsunit/nans.js
+++ b/test/mjsunit/nans.js
@@ -97,7 +97,3 @@
}
TestFloatQuietNan();
-
-
-
-
diff --git a/test/mjsunit/never-optimize.js b/test/mjsunit/never-optimize.js
index 55b1f11..643588e 100644
--- a/test/mjsunit/never-optimize.js
+++ b/test/mjsunit/never-optimize.js
@@ -60,4 +60,4 @@
// 2 => not optimized.
assertUnoptimized(u1);
assertOptimized(u2);
-}
\ No newline at end of file
+}
diff --git a/test/mjsunit/new.js b/test/mjsunit/new.js
index 1062628..ca098a1 100644
--- a/test/mjsunit/new.js
+++ b/test/mjsunit/new.js
@@ -53,4 +53,3 @@
assertTrue(x === new Construct(x));
x = function() { };
assertTrue(x === new Construct(x));
-
diff --git a/test/mjsunit/newline-in-string.js b/test/mjsunit/newline-in-string.js
index 8c3ff86..e71d8cf 100644
--- a/test/mjsunit/newline-in-string.js
+++ b/test/mjsunit/newline-in-string.js
@@ -42,5 +42,3 @@
// Allow LF+CR in multiline string literals.
code = "'asdf\\" + String.fromCharCode(0xA) + String.fromCharCode(0xD) + "asdf'";
assertEquals('asdfasdf', eval(code));
-
-
diff --git a/test/mjsunit/number-tostring-func.js b/test/mjsunit/number-tostring-func.js
index c64706e..4fc97e5 100644
--- a/test/mjsunit/number-tostring-func.js
+++ b/test/mjsunit/number-tostring-func.js
@@ -362,6 +362,3 @@
// dtoa does not do this in its original form.
assertEquals("1.3", 1.25.toPrecision(2), "1.25.toPrecision(2)");
assertEquals("1.4", 1.35.toPrecision(2), "1.35.toPrecision(2)");
-
-
-
diff --git a/test/mjsunit/number-tostring-small.js b/test/mjsunit/number-tostring-small.js
index dbd2b59..068b3a4 100644
--- a/test/mjsunit/number-tostring-small.js
+++ b/test/mjsunit/number-tostring-small.js
@@ -392,4 +392,3 @@
(-91.1234).toPrecision(6);
(-91.1234).toPrecision(7);
(-91.1234).toPrecision(8);
-
diff --git a/test/mjsunit/number-tostring.js b/test/mjsunit/number-tostring.js
index 35e77e2..55655f4 100644
--- a/test/mjsunit/number-tostring.js
+++ b/test/mjsunit/number-tostring.js
@@ -335,6 +335,3 @@
// dtoa does not do this in its original form.
assertEquals("1.3", 1.25.toPrecision(2), "1.25.toPrecision(2)");
assertEquals("1.4", 1.35.toPrecision(2), "1.35.toPrecision(2)");
-
-
-
diff --git a/test/mjsunit/object-literal-conversions.js b/test/mjsunit/object-literal-conversions.js
index 742f814..7db2cf5 100644
--- a/test/mjsunit/object-literal-conversions.js
+++ b/test/mjsunit/object-literal-conversions.js
@@ -43,4 +43,3 @@
assertEquals(7, test5[13]);
assertEquals(7, test6[17.31]);
-
diff --git a/test/mjsunit/object-literal-gc.js b/test/mjsunit/object-literal-gc.js
index b9d6285..ddbeef6 100644
--- a/test/mjsunit/object-literal-gc.js
+++ b/test/mjsunit/object-literal-gc.js
@@ -63,4 +63,3 @@
for (var i = 0; i < sizes.length; i++) {
testLiteral(sizes[i]);
}
-
diff --git a/test/mjsunit/packed-elements.js b/test/mjsunit/packed-elements.js
index cfcdf80..4a87373 100644
--- a/test/mjsunit/packed-elements.js
+++ b/test/mjsunit/packed-elements.js
@@ -109,4 +109,3 @@
test_with_optimization(test5);
test_with_optimization(test6);
}
-
diff --git a/test/mjsunit/property-object-key.js b/test/mjsunit/property-object-key.js
index 5eb1e1b..3556cb9 100644
--- a/test/mjsunit/property-object-key.js
+++ b/test/mjsunit/property-object-key.js
@@ -33,4 +33,3 @@
assertEquals(87, object[key]);
object[key]++;
assertEquals(88, object[key]);
-
diff --git a/test/mjsunit/prototype.js b/test/mjsunit/prototype.js
index bfc1a79..a953422 100644
--- a/test/mjsunit/prototype.js
+++ b/test/mjsunit/prototype.js
@@ -89,5 +89,3 @@
test.__proto__ = (new Array()).__proto__;
test.length = 14;
assertEquals(14, test.length);
-
-
diff --git a/test/mjsunit/regexp-indexof.js b/test/mjsunit/regexp-indexof.js
index a504dd8..09f2fec 100644
--- a/test/mjsunit/regexp-indexof.js
+++ b/test/mjsunit/regexp-indexof.js
@@ -74,4 +74,4 @@
CheckMatch(/a|(?:)/g, "aba", [[0, 1], [1, 0], [2, 1], [3, 0]]);
CheckMatch(/a|(?:)/g, "baba", [[0, 0], [1, 1], [2, 0], [3, 1], [4, 0]]);
-CheckMatch(/a|(?:)/g, "bab", [[0, 0], [1, 1], [2, 0], [3, 0]]);
\ No newline at end of file
+CheckMatch(/a|(?:)/g, "bab", [[0, 0], [1, 1], [2, 0], [3, 0]]);
diff --git a/test/mjsunit/regexp-results-cache.js b/test/mjsunit/regexp-results-cache.js
index 7ee8c3f..9de8661 100644
--- a/test/mjsunit/regexp-results-cache.js
+++ b/test/mjsunit/regexp-results-cache.js
@@ -75,4 +75,3 @@
words[0] = "Enemies,";
words = string.split(" ");
assertEquals("Friends,", words[0]);
-
diff --git a/test/mjsunit/regress/regress-1017.js b/test/mjsunit/regress/regress-1017.js
index 3daf542..440449a 100644
--- a/test/mjsunit/regress/regress-1017.js
+++ b/test/mjsunit/regress/regress-1017.js
@@ -33,4 +33,3 @@
// to store the 33rd character. This fails an ASSERT in debug mode.
assertEquals(33, "12345678901234567890123456789012\u2028".length);
-
diff --git a/test/mjsunit/regress/regress-1039610.js b/test/mjsunit/regress/regress-1039610.js
index fd5c549..757801f 100644
--- a/test/mjsunit/regress/regress-1039610.js
+++ b/test/mjsunit/regress/regress-1039610.js
@@ -26,4 +26,4 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Make sure that the Debug object does not return to the global object
-assertTrue(typeof(Debug) === 'undefined');
\ No newline at end of file
+assertTrue(typeof(Debug) === 'undefined');
diff --git a/test/mjsunit/regress/regress-105.js b/test/mjsunit/regress/regress-105.js
index 9a4d5c4..8b8030f 100644
--- a/test/mjsunit/regress/regress-105.js
+++ b/test/mjsunit/regress/regress-105.js
@@ -41,4 +41,3 @@
assertEquals(2, Number(object));
assertEquals('I', String(object)[0]);
-
diff --git a/test/mjsunit/regress/regress-1066899.js b/test/mjsunit/regress/regress-1066899.js
index 37fd554..5840f26 100644
--- a/test/mjsunit/regress/regress-1066899.js
+++ b/test/mjsunit/regress/regress-1066899.js
@@ -34,4 +34,3 @@
}
Crash();
-
diff --git a/test/mjsunit/regress/regress-1092.js b/test/mjsunit/regress/regress-1092.js
index 00422cb..24efb37 100644
--- a/test/mjsunit/regress/regress-1092.js
+++ b/test/mjsunit/regress/regress-1092.js
@@ -32,4 +32,3 @@
this.x = 1;
this.y = 2;
this.z = 3;
-
diff --git a/test/mjsunit/regress/regress-1099.js b/test/mjsunit/regress/regress-1099.js
index 36f09e4..49e4a52 100644
--- a/test/mjsunit/regress/regress-1099.js
+++ b/test/mjsunit/regress/regress-1099.js
@@ -48,4 +48,4 @@
}
%OptimizeFunctionOnNextCall(y);
-assertTrue(y("foo"));
\ No newline at end of file
+assertTrue(y("foo"));
diff --git a/test/mjsunit/regress/regress-1112.js b/test/mjsunit/regress/regress-1112.js
index d780106..41c9193 100644
--- a/test/mjsunit/regress/regress-1112.js
+++ b/test/mjsunit/regress/regress-1112.js
@@ -33,4 +33,3 @@
{ configurable: true, enumerable: true, value: 3 });
assertEquals(3, this[1]);
assertTrue(this.hasOwnProperty("1"));
-
diff --git a/test/mjsunit/regress/regress-1114040.js b/test/mjsunit/regress/regress-1114040.js
index 9d1b320..ef7ee31 100644
--- a/test/mjsunit/regress/regress-1114040.js
+++ b/test/mjsunit/regress/regress-1114040.js
@@ -55,4 +55,3 @@
assertEquals("01", TestBreak());
assertEquals("01", TestContinue());
-
diff --git a/test/mjsunit/regress/regress-1117.js b/test/mjsunit/regress/regress-1117.js
index 981a1b7..664dadd 100644
--- a/test/mjsunit/regress/regress-1117.js
+++ b/test/mjsunit/regress/regress-1117.js
@@ -41,4 +41,3 @@
assertEquals(Infinity, 1/bar(5));
%OptimizeFunctionOnNextCall(bar);
assertEquals(-Infinity, 1/bar(-5));
-
diff --git a/test/mjsunit/regress/regress-1178598.js b/test/mjsunit/regress/regress-1178598.js
index 9caaec2..135c596 100644
--- a/test/mjsunit/regress/regress-1178598.js
+++ b/test/mjsunit/regress/regress-1178598.js
@@ -86,5 +86,3 @@
})();
assertEquals(87, value);
-
-
diff --git a/test/mjsunit/regress/regress-1181.js b/test/mjsunit/regress/regress-1181.js
index d45a0be..d5b8ab1 100644
--- a/test/mjsunit/regress/regress-1181.js
+++ b/test/mjsunit/regress/regress-1181.js
@@ -51,4 +51,4 @@
check(150);
check(200);
-check(350);
\ No newline at end of file
+check(350);
diff --git a/test/mjsunit/regress/regress-1246.js b/test/mjsunit/regress/regress-1246.js
index f3dbec6..ca425ec 100644
--- a/test/mjsunit/regress/regress-1246.js
+++ b/test/mjsunit/regress/regress-1246.js
@@ -80,4 +80,3 @@
assertEquals(0xaf, parseInt("0xaf", radix));
assertEquals(0xaf, parseInt("af", radix));
}
-
diff --git a/test/mjsunit/regress/regress-1254366.js b/test/mjsunit/regress/regress-1254366.js
index 2f9e011..9acda3c 100644
--- a/test/mjsunit/regress/regress-1254366.js
+++ b/test/mjsunit/regress/regress-1254366.js
@@ -35,4 +35,3 @@
var a = new Object();
assertEquals(gee, a.findOrStore());
assertEquals(gee, a.findOrStore());
-
diff --git a/test/mjsunit/regress/regress-131994.js b/test/mjsunit/regress/regress-131994.js
index 8347653..7f60095 100644
--- a/test/mjsunit/regress/regress-131994.js
+++ b/test/mjsunit/regress/regress-131994.js
@@ -67,4 +67,3 @@
h();
assertFalse(exception);
-
diff --git a/test/mjsunit/regress/regress-137.js b/test/mjsunit/regress/regress-137.js
index cc7b68c..f343eba 100644
--- a/test/mjsunit/regress/regress-137.js
+++ b/test/mjsunit/regress/regress-137.js
@@ -43,4 +43,3 @@
};
fail("case 10", "Default case", "Heap number not recognized as Smi value");
})();
-
diff --git a/test/mjsunit/regress/regress-1546.js b/test/mjsunit/regress/regress-1546.js
index 7f1fa58..3f1839c 100644
--- a/test/mjsunit/regress/regress-1546.js
+++ b/test/mjsunit/regress/regress-1546.js
@@ -29,4 +29,4 @@
// Should't throw. Scanner incorrectly truncated to char before comparing
// with "*", so it ended the comment early.
-eval("/*\u822a/ */");
\ No newline at end of file
+eval("/*\u822a/ */");
diff --git a/test/mjsunit/regress/regress-1591.js b/test/mjsunit/regress/regress-1591.js
index 69efd0b..dbf40df 100644
--- a/test/mjsunit/regress/regress-1591.js
+++ b/test/mjsunit/regress/regress-1591.js
@@ -45,4 +45,3 @@
var expected_message = "ReferenceError: f is not defined";
assertTrue(stack.indexOf(expected_message) >= 0);
assertFalse(used_custom_lookup);
-
diff --git a/test/mjsunit/regress/regress-1647.js b/test/mjsunit/regress/regress-1647.js
index a6afcc0..ab6608c 100644
--- a/test/mjsunit/regress/regress-1647.js
+++ b/test/mjsunit/regress/regress-1647.js
@@ -40,4 +40,3 @@
%OptimizeFunctionOnNextCall(f);
t.number = 2;
f();
-
diff --git a/test/mjsunit/regress/regress-166379.js b/test/mjsunit/regress/regress-166379.js
index b19afbd..2cda611 100644
--- a/test/mjsunit/regress/regress-166379.js
+++ b/test/mjsunit/regress/regress-166379.js
@@ -36,4 +36,3 @@
// Surprise mod with overflow.
assertEquals(-Infinity, 1/mod(-2147483648, -1));
-
diff --git a/test/mjsunit/regress/regress-1748.js b/test/mjsunit/regress/regress-1748.js
index e287e55..41b7c70 100644
--- a/test/mjsunit/regress/regress-1748.js
+++ b/test/mjsunit/regress/regress-1748.js
@@ -32,4 +32,4 @@
var str = Array(10000).join("X");
str.replace(/^|X/g, function(m, i, s) {
if (i > 0) assertEquals("X", m, "at position 0x" + i.toString(16));
-});
\ No newline at end of file
+});
diff --git a/test/mjsunit/regress/regress-1757.js b/test/mjsunit/regress/regress-1757.js
index f7a5516..35e7355 100644
--- a/test/mjsunit/regress/regress-1757.js
+++ b/test/mjsunit/regress/regress-1757.js
@@ -29,4 +29,4 @@
var a = "abcdefghijklmnopqrstuvqxy"+"z";
externalizeString(a, true);
-assertEquals('b', a.substring(1).charAt(0));
\ No newline at end of file
+assertEquals('b', a.substring(1).charAt(0));
diff --git a/test/mjsunit/regress/regress-1853.js b/test/mjsunit/regress/regress-1853.js
index cfafe82..7175688 100644
--- a/test/mjsunit/regress/regress-1853.js
+++ b/test/mjsunit/regress/regress-1853.js
@@ -113,4 +113,3 @@
test1();
test2();
assertEquals(3, break_count);
-
diff --git a/test/mjsunit/regress/regress-186.js b/test/mjsunit/regress/regress-186.js
index 335869d..0212855 100644
--- a/test/mjsunit/regress/regress-186.js
+++ b/test/mjsunit/regress/regress-186.js
@@ -69,4 +69,3 @@
runTest(testLocal);
runTest(testConstLocal);
runTest(testGlobal);
-
diff --git a/test/mjsunit/regress/regress-1919169.js b/test/mjsunit/regress/regress-1919169.js
index a732312..fbb82ba 100644
--- a/test/mjsunit/regress/regress-1919169.js
+++ b/test/mjsunit/regress/regress-1919169.js
@@ -37,4 +37,3 @@
// Crash does not occur when code is run at the top level.
test();
-
diff --git a/test/mjsunit/regress/regress-193.js b/test/mjsunit/regress/regress-193.js
index f803483..457c208 100644
--- a/test/mjsunit/regress/regress-193.js
+++ b/test/mjsunit/regress/regress-193.js
@@ -40,5 +40,3 @@
// The call to f should get the constructor of the receiver which is
// the constructor of the global object.
assertEquals(constructor, f());
-
-
diff --git a/test/mjsunit/regress/regress-20070207.js b/test/mjsunit/regress/regress-20070207.js
index b7f7a5c..701a079 100644
--- a/test/mjsunit/regress/regress-20070207.js
+++ b/test/mjsunit/regress/regress-20070207.js
@@ -39,4 +39,3 @@
assertFalse(f(-5));
assertFalse(f(0));
assertFalse(f(10));
-
diff --git a/test/mjsunit/regress/regress-2027.js b/test/mjsunit/regress/regress-2027.js
index 00ed03f..3f2062b 100644
--- a/test/mjsunit/regress/regress-2027.js
+++ b/test/mjsunit/regress/regress-2027.js
@@ -45,4 +45,3 @@
Check(d.setUTCDate(10));
Check(d.setUTCMonth(10));
Check(d.setUTCFullYear(2010));
-
diff --git a/test/mjsunit/regress/regress-2119.js b/test/mjsunit/regress/regress-2119.js
index 54840c2..b735ddf 100644
--- a/test/mjsunit/regress/regress-2119.js
+++ b/test/mjsunit/regress/regress-2119.js
@@ -33,4 +33,3 @@
}
assertThrows(strict_function);
-
diff --git a/test/mjsunit/regress/regress-2170.js b/test/mjsunit/regress/regress-2170.js
index 01cb1ea..99f432d 100644
--- a/test/mjsunit/regress/regress-2170.js
+++ b/test/mjsunit/regress/regress-2170.js
@@ -55,4 +55,3 @@
} catch (e) {
assertUnreachable();
}
-
diff --git a/test/mjsunit/regress/regress-2172.js b/test/mjsunit/regress/regress-2172.js
index 5d06f4e..6d93845 100644
--- a/test/mjsunit/regress/regress-2172.js
+++ b/test/mjsunit/regress/regress-2172.js
@@ -32,4 +32,3 @@
for (var i = 0; i < 10000; i++){
(i + "\u1234\0").split(/(.)\1/i);
}
-
diff --git a/test/mjsunit/regress/regress-2250.js b/test/mjsunit/regress/regress-2250.js
index 9d2fd44..88d4dd4 100644
--- a/test/mjsunit/regress/regress-2250.js
+++ b/test/mjsunit/regress/regress-2250.js
@@ -65,4 +65,3 @@
// function should no longer deopt when called.
test();
assertOptimized(test);
-
diff --git a/test/mjsunit/regress/regress-2285.js b/test/mjsunit/regress/regress-2285.js
index efda4cd..a0d628d 100644
--- a/test/mjsunit/regress/regress-2285.js
+++ b/test/mjsunit/regress/regress-2285.js
@@ -29,4 +29,3 @@
assertThrows(function() { %_CallFunction(null, 0, ""); });
assertThrows(function() { %_CallFunction(null, 0, 1); });
-
diff --git a/test/mjsunit/regress/regress-2289.js b/test/mjsunit/regress/regress-2289.js
index e89ec6e..d860bbb 100644
--- a/test/mjsunit/regress/regress-2289.js
+++ b/test/mjsunit/regress/regress-2289.js
@@ -30,5 +30,3 @@
foo = foo + 'b' + foo;
foo.replace(/b/, "a");
-
-
diff --git a/test/mjsunit/regress/regress-231.js b/test/mjsunit/regress/regress-231.js
index 0c6e5b3..bce0500 100644
--- a/test/mjsunit/regress/regress-231.js
+++ b/test/mjsunit/regress/regress-231.js
@@ -89,4 +89,4 @@
//Shouldn't crash.
var res = re.test(str);
-assertTrue(res);
\ No newline at end of file
+assertTrue(res);
diff --git a/test/mjsunit/regress/regress-2374.js b/test/mjsunit/regress/regress-2374.js
index b333720..f379cc5 100644
--- a/test/mjsunit/regress/regress-2374.js
+++ b/test/mjsunit/regress/regress-2374.js
@@ -31,4 +31,4 @@
var obj2 = JSON.parse(msg);
assertEquals(JSON.stringify(obj), JSON.stringify(obj2));
-assertEquals(JSON.stringify(obj, null, 0), JSON.stringify(obj2));
\ No newline at end of file
+assertEquals(JSON.stringify(obj, null, 0), JSON.stringify(obj2));
diff --git a/test/mjsunit/regress/regress-237617.js b/test/mjsunit/regress/regress-237617.js
index dabf828..7b7e50f 100644
--- a/test/mjsunit/regress/regress-237617.js
+++ b/test/mjsunit/regress/regress-237617.js
@@ -40,4 +40,3 @@
assertTrue(error_stack.indexOf("test stack") > 0);
assertTrue(error_stack.indexOf("illegal") < 0);
-
diff --git a/test/mjsunit/regress/regress-2419.js b/test/mjsunit/regress/regress-2419.js
index 9cd453a..4ffafbe 100644
--- a/test/mjsunit/regress/regress-2419.js
+++ b/test/mjsunit/regress/regress-2419.js
@@ -34,4 +34,3 @@
Object.freeze(b);
Array.prototype.sort.call(b);
assertPropertiesEqual({0: 5, 1: 4, 2: 3, 3: 2, 4: 1, 5: 0, length: 6}, b);
-
diff --git a/test/mjsunit/regress/regress-2438.js b/test/mjsunit/regress/regress-2438.js
index 3f4fd7d..7be7e71 100644
--- a/test/mjsunit/regress/regress-2438.js
+++ b/test/mjsunit/regress/regress-2438.js
@@ -49,4 +49,3 @@
testSideEffects("zzzz", /a/g);
testSideEffects("xaxa", /a/);
testSideEffects("xaxa", /a/g);
-
diff --git a/test/mjsunit/regress/regress-2444.js b/test/mjsunit/regress/regress-2444.js
index 8fb8d8b..41b6a95 100644
--- a/test/mjsunit/regress/regress-2444.js
+++ b/test/mjsunit/regress/regress-2444.js
@@ -116,5 +116,3 @@
object_factory(1, 0, [1, 0, 0]),
object_factory(2, 1, [1, 1, 0])));
assertFlags([1, 1, 1]);
-
-
diff --git a/test/mjsunit/regress/regress-246.js b/test/mjsunit/regress/regress-246.js
index 09b746b..22e29fd 100644
--- a/test/mjsunit/regress/regress-246.js
+++ b/test/mjsunit/regress/regress-246.js
@@ -28,4 +28,4 @@
// See: http://code.google.com/p/v8/issues/detail?id=246
assertTrue(/(?:text)/.test("text"));
-assertEquals(["text"], /(?:text)/.exec("text"));
\ No newline at end of file
+assertEquals(["text"], /(?:text)/.exec("text"));
diff --git a/test/mjsunit/regress/regress-2570.js b/test/mjsunit/regress/regress-2570.js
index 4e32a21..f1331e8 100644
--- a/test/mjsunit/regress/regress-2570.js
+++ b/test/mjsunit/regress/regress-2570.js
@@ -29,4 +29,4 @@
"\u00e6"]; // Latin-1 character.
assertEquals('["\u56e7","\u00e6"]', JSON.stringify(o));
-assertEquals('["\u56e7","\u00e6"]', JSON.stringify(o, null, 0));
\ No newline at end of file
+assertEquals('["\u56e7","\u00e6"]', JSON.stringify(o, null, 0));
diff --git a/test/mjsunit/regress/regress-2596.js b/test/mjsunit/regress/regress-2596.js
index 1d327fe..e700608 100644
--- a/test/mjsunit/regress/regress-2596.js
+++ b/test/mjsunit/regress/regress-2596.js
@@ -51,6 +51,3 @@
assertTrue(isNaN(boom(0)));
assertTrue(isNaN(boom(0)));
assertTrue(isNaN(boom(0)));
-
-
-
diff --git a/test/mjsunit/regress/regress-2624.js b/test/mjsunit/regress/regress-2624.js
index 2bfd7b2..fe94a10 100644
--- a/test/mjsunit/regress/regress-2624.js
+++ b/test/mjsunit/regress/regress-2624.js
@@ -33,4 +33,3 @@
}
source += '"';
eval(source);
-
diff --git a/test/mjsunit/regress/regress-2671-1.js b/test/mjsunit/regress/regress-2671-1.js
index 042a501..7937d6a 100644
--- a/test/mjsunit/regress/regress-2671-1.js
+++ b/test/mjsunit/regress/regress-2671-1.js
@@ -42,4 +42,3 @@
f();
%OptimizeFunctionOnNextCall(f);
f();
-
diff --git a/test/mjsunit/regress/regress-2671.js b/test/mjsunit/regress/regress-2671.js
index 8da1b8f..73a3098 100644
--- a/test/mjsunit/regress/regress-2671.js
+++ b/test/mjsunit/regress/regress-2671.js
@@ -42,4 +42,3 @@
f();
%OptimizeFunctionOnNextCall(f);
f();
-
diff --git a/test/mjsunit/regress/regress-2690.js b/test/mjsunit/regress/regress-2690.js
index 5fe7dc4..0ed4c5c 100644
--- a/test/mjsunit/regress/regress-2690.js
+++ b/test/mjsunit/regress/regress-2690.js
@@ -26,4 +26,3 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
assertTrue(/\1[a]/.test("\1a"));
-
diff --git a/test/mjsunit/regress/regress-298269.js b/test/mjsunit/regress/regress-298269.js
index 329ff82..f6604df 100644
--- a/test/mjsunit/regress/regress-298269.js
+++ b/test/mjsunit/regress/regress-298269.js
@@ -42,4 +42,4 @@
var s3 = "string for triggering osr in Cb";
for (var i = 0; i < 16; i++) s3 = s3 + s3;
Cb(s3);
-Cb(s1 + s2);
\ No newline at end of file
+Cb(s1 + s2);
diff --git a/test/mjsunit/regress/regress-2984.js b/test/mjsunit/regress/regress-2984.js
index de7895d..914409c 100644
--- a/test/mjsunit/regress/regress-2984.js
+++ b/test/mjsunit/regress/regress-2984.js
@@ -31,4 +31,3 @@
assertEquals("\xff", "\u0178".toLowerCase());
assertEquals("ABCDEFGHIJKLMN\u0178OPQ",
("abcdefghijk" + "lmn\xffopq").toUpperCase());
-
diff --git a/test/mjsunit/regress/regress-317.js b/test/mjsunit/regress/regress-317.js
index b742fa1..85f408b 100644
--- a/test/mjsunit/regress/regress-317.js
+++ b/test/mjsunit/regress/regress-317.js
@@ -28,4 +28,3 @@
// Ensure replacement with string allows $ in replacement string.
assertEquals("a$ec", "abc".replace("b", "$e"), "$e isn't meaningful");
-
diff --git a/test/mjsunit/regress/regress-319722-ArrayBuffer.js b/test/mjsunit/regress/regress-319722-ArrayBuffer.js
index 1849bd2..4a48a61 100644
--- a/test/mjsunit/regress/regress-319722-ArrayBuffer.js
+++ b/test/mjsunit/regress/regress-319722-ArrayBuffer.js
@@ -55,4 +55,3 @@
TestArray(Float32Array);
TestArray(Float64Array);
TestArray(Uint8ClampedArray);
-
diff --git a/test/mjsunit/regress/regress-45469.js b/test/mjsunit/regress/regress-45469.js
index 832a73f..1abe0f9 100644
--- a/test/mjsunit/regress/regress-45469.js
+++ b/test/mjsunit/regress/regress-45469.js
@@ -42,5 +42,3 @@
var res = re.test("xx");
assertEquals(i % 3 != 2, res, "testres" + i);
}
-
-
diff --git a/test/mjsunit/regress/regress-483.js b/test/mjsunit/regress/regress-483.js
index db93f59..7370134 100644
--- a/test/mjsunit/regress/regress-483.js
+++ b/test/mjsunit/regress/regress-483.js
@@ -32,4 +32,3 @@
X.prototype.x = {x:1}
new X()
-
diff --git a/test/mjsunit/regress/regress-588599.js b/test/mjsunit/regress/regress-588599.js
index a1c16e2..eece492 100644
--- a/test/mjsunit/regress/regress-588599.js
+++ b/test/mjsunit/regress/regress-588599.js
@@ -28,4 +28,3 @@
assertFalse(Infinity == -Infinity);
assertEquals(Infinity, 1 / 1e-9999);
assertEquals(-Infinity, 1 / -1e-9999);
-
diff --git a/test/mjsunit/regress/regress-619.js b/test/mjsunit/regress/regress-619.js
index 4d3e66b..c18a8ac 100644
--- a/test/mjsunit/regress/regress-619.js
+++ b/test/mjsunit/regress/regress-619.js
@@ -58,4 +58,3 @@
for(var i = 0; i < 1024; i++) {
assertEquals(i, obj[i]);
}
-
diff --git a/test/mjsunit/regress/regress-670147.js b/test/mjsunit/regress/regress-670147.js
index b5b00d0..916c13d 100644
--- a/test/mjsunit/regress/regress-670147.js
+++ b/test/mjsunit/regress/regress-670147.js
@@ -31,4 +31,3 @@
}
assertFalse(XXX('Hello'));
-
diff --git a/test/mjsunit/regress/regress-674753.js b/test/mjsunit/regress/regress-674753.js
index 361b457..b3704ea 100644
--- a/test/mjsunit/regress/regress-674753.js
+++ b/test/mjsunit/regress/regress-674753.js
@@ -84,4 +84,3 @@
assertFalse(typeof 'x' === 'object');
assertFalse(typeof Object == 'object');
assertFalse(typeof Object === 'object');
-
diff --git a/test/mjsunit/regress/regress-675.js b/test/mjsunit/regress/regress-675.js
index 19ca646..bef7b27 100644
--- a/test/mjsunit/regress/regress-675.js
+++ b/test/mjsunit/regress/regress-675.js
@@ -58,4 +58,3 @@
// Check that IC bails out.
assertEquals(42, g());
-
diff --git a/test/mjsunit/regress/regress-678525.js b/test/mjsunit/regress/regress-678525.js
index 11eaf74..49059c6 100644
--- a/test/mjsunit/regress/regress-678525.js
+++ b/test/mjsunit/regress/regress-678525.js
@@ -55,5 +55,3 @@
assertEquals(73, '\111'.charCodeAt(0));
assertEquals(105, '\151'.charCodeAt(0));
-
-
diff --git a/test/mjsunit/regress/regress-734862.js b/test/mjsunit/regress/regress-734862.js
index 6239047..40e5b1d 100644
--- a/test/mjsunit/regress/regress-734862.js
+++ b/test/mjsunit/regress/regress-734862.js
@@ -34,4 +34,3 @@
assertTrue(catcher(void 0, 'foo') instanceof TypeError);
assertTrue(catcher(null, 123) instanceof TypeError);
assertTrue(catcher(void 0, 123) instanceof TypeError);
-
diff --git a/test/mjsunit/regress/regress-74.js b/test/mjsunit/regress/regress-74.js
index f22b33c..bdc3b5c 100644
--- a/test/mjsunit/regress/regress-74.js
+++ b/test/mjsunit/regress/regress-74.js
@@ -38,4 +38,3 @@
}
test();
-
diff --git a/test/mjsunit/regress/regress-753.js b/test/mjsunit/regress/regress-753.js
index 4621de6..0253962 100644
--- a/test/mjsunit/regress/regress-753.js
+++ b/test/mjsunit/regress/regress-753.js
@@ -33,4 +33,3 @@
var obj = {a1: {b1: [1,2,3,4], b2: {c1: 1, c2: 2}},a2: 'a2'};
assertEquals(JSON.stringify(obj, null, 5.99999), JSON.stringify(obj, null, 5));
-
diff --git a/test/mjsunit/regress/regress-806473.js b/test/mjsunit/regress/regress-806473.js
index 6d6485d..91c9a9f 100644
--- a/test/mjsunit/regress/regress-806473.js
+++ b/test/mjsunit/regress/regress-806473.js
@@ -56,5 +56,3 @@
assertEquals(10, i);
assertEquals(10, j);
-
-
diff --git a/test/mjsunit/regress/regress-85177.js b/test/mjsunit/regress/regress-85177.js
index 275bbe7..aa938f5 100644
--- a/test/mjsunit/regress/regress-85177.js
+++ b/test/mjsunit/regress/regress-85177.js
@@ -62,4 +62,3 @@
f();
%OptimizeFunctionOnNextCall(f);
f();
-
diff --git a/test/mjsunit/regress/regress-892742.js b/test/mjsunit/regress/regress-892742.js
index 78a57b2..fd79fc0 100644
--- a/test/mjsunit/regress/regress-892742.js
+++ b/test/mjsunit/regress/regress-892742.js
@@ -45,4 +45,3 @@
assertEquals(1, f());
assertEquals(undefined, g());
assertEquals(undefined, h());
-
diff --git a/test/mjsunit/regress/regress-925537.js b/test/mjsunit/regress/regress-925537.js
index d50c568..6d75504 100644
--- a/test/mjsunit/regress/regress-925537.js
+++ b/test/mjsunit/regress/regress-925537.js
@@ -39,4 +39,3 @@
assertClose(-Math.PI / 4, Math.atan2(ninf, pinf));
assertClose( 3 * Math.PI / 4, Math.atan2(pinf, ninf));
assertClose(-3 * Math.PI / 4, Math.atan2(ninf, ninf));
-
diff --git a/test/mjsunit/regress/regress-94873.js b/test/mjsunit/regress/regress-94873.js
index 41ca992..b61bc0c 100644
--- a/test/mjsunit/regress/regress-94873.js
+++ b/test/mjsunit/regress/regress-94873.js
@@ -75,4 +75,4 @@
}
Debug.setBreakPoint(a, 0, 0);
-new a(1, 2);
\ No newline at end of file
+new a(1, 2);
diff --git a/test/mjsunit/regress/regress-990205.js b/test/mjsunit/regress/regress-990205.js
index b3024c2..7eb66f0 100644
--- a/test/mjsunit/regress/regress-990205.js
+++ b/test/mjsunit/regress/regress-990205.js
@@ -36,4 +36,3 @@
};
assertThrows("f()");
-
diff --git a/test/mjsunit/regress/regress-995.js b/test/mjsunit/regress/regress-995.js
index e88121a..6f3dac1 100644
--- a/test/mjsunit/regress/regress-995.js
+++ b/test/mjsunit/regress/regress-995.js
@@ -54,4 +54,3 @@
}
}
h(undefined);
-
diff --git a/test/mjsunit/regress/regress-998565.js b/test/mjsunit/regress/regress-998565.js
index 260b791..840c045 100644
--- a/test/mjsunit/regress/regress-998565.js
+++ b/test/mjsunit/regress/regress-998565.js
@@ -48,4 +48,4 @@
f();
// Make sure that the debug event listener vas invoked.
-assertTrue(listenerCalled);
\ No newline at end of file
+assertTrue(listenerCalled);
diff --git a/test/mjsunit/regress/regress-add-minus-zero.js b/test/mjsunit/regress/regress-add-minus-zero.js
index 0b4af75..cb77cdf 100644
--- a/test/mjsunit/regress/regress-add-minus-zero.js
+++ b/test/mjsunit/regress/regress-add-minus-zero.js
@@ -35,4 +35,3 @@
assertEquals("Infinity", String(1/f()));
%OptimizeFunctionOnNextCall(f);
assertEquals("Infinity", String(1/f()));
-
diff --git a/test/mjsunit/regress/regress-array-pop-nonconfigurable.js b/test/mjsunit/regress/regress-array-pop-nonconfigurable.js
index 129e198..823bb6b 100644
--- a/test/mjsunit/regress/regress-array-pop-nonconfigurable.js
+++ b/test/mjsunit/regress/regress-array-pop-nonconfigurable.js
@@ -28,4 +28,3 @@
var a = [];
Object.defineProperty(a, 0, {});
assertThrows(function() { a.pop(); });
-
diff --git a/test/mjsunit/regress/regress-binop-nosse2.js b/test/mjsunit/regress/regress-binop-nosse2.js
index c6cbaf7..29c8a04 100644
--- a/test/mjsunit/regress/regress-binop-nosse2.js
+++ b/test/mjsunit/regress/regress-binop-nosse2.js
@@ -165,4 +165,3 @@
assertEquals(t2(undefined,2), NaN/2);
assertEquals(t2(1,1<<30), 1/(1<<30));
assertEquals(t2(1,2), 1/2);
-
diff --git a/test/mjsunit/regress/regress-builtin-array-op.js b/test/mjsunit/regress/regress-builtin-array-op.js
index 1e37af3..ea5891f 100644
--- a/test/mjsunit/regress/regress-builtin-array-op.js
+++ b/test/mjsunit/regress/regress-builtin-array-op.js
@@ -35,4 +35,3 @@
a[100000] = 0;
a.join();
assertEquals("hest", foo);
-
diff --git a/test/mjsunit/regress/regress-clobbered-fp-regs.js b/test/mjsunit/regress/regress-clobbered-fp-regs.js
new file mode 100644
index 0000000..7795ae9
--- /dev/null
+++ b/test/mjsunit/regress/regress-clobbered-fp-regs.js
@@ -0,0 +1,54 @@
+// Copyright 2011 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Flags: --allow-natives-syntax
+
+function store(a, x, y) {
+ var f1 = 0.1 * y;
+ var f2 = 0.2 * y;
+ var f3 = 0.3 * y;
+ var f4 = 0.4 * y;
+ var f5 = 0.5 * y;
+ var f6 = 0.6 * y;
+ var f7 = 0.7 * y;
+ var f8 = 0.8 * y;
+ a[0] = x;
+ var sum = (f1 + f2 + f3 + f4 + f5 + f6 + f7 + f8);
+ assertEquals(1, y);
+ var expected = 3.6;
+ if (Math.abs(expected - sum) > 0.01) {
+ assertEquals(expected, sum);
+ }
+}
+
+// Generate TransitionElementsKindStub.
+store([1], 1, 1);
+store([1], 1.1, 1);
+store([1], 1.1, 1);
+%OptimizeFunctionOnNextCall(store);
+// This will trap on allocation site in TransitionElementsKindStub.
+store([1], 1, 1)
diff --git a/test/mjsunit/regress/regress-crbug-158185.js b/test/mjsunit/regress/regress-crbug-158185.js
index 99f19c7..5cb5900 100644
--- a/test/mjsunit/regress/regress-crbug-158185.js
+++ b/test/mjsunit/regress/regress-crbug-158185.js
@@ -36,4 +36,3 @@
assertEquals(1, JSON.parse('{"0":1}')[0]);
assertEquals(undefined, JSON.parse('{"00":1}')[0]);
-
diff --git a/test/mjsunit/regress/regress-crbug-178790.js b/test/mjsunit/regress/regress-crbug-178790.js
index 57071ea..25cc96b 100644
--- a/test/mjsunit/regress/regress-crbug-178790.js
+++ b/test/mjsunit/regress/regress-crbug-178790.js
@@ -49,4 +49,3 @@
r3 = "(" + r3 + ")a";
}
"test".match(RegExp(r3));
-
diff --git a/test/mjsunit/regress/regress-crbug-18639.js b/test/mjsunit/regress/regress-crbug-18639.js
index 4f4bb7c..6c8e6ad 100644
--- a/test/mjsunit/regress/regress-crbug-18639.js
+++ b/test/mjsunit/regress/regress-crbug-18639.js
@@ -35,4 +35,4 @@
((0).toLocaleString)();
} catch (e) {
assertInstanceof(e, TypeError);
-}
\ No newline at end of file
+}
diff --git a/test/mjsunit/regress/regress-crbug-222893.js b/test/mjsunit/regress/regress-crbug-222893.js
index d5baa7b..39363bc 100644
--- a/test/mjsunit/regress/regress-crbug-222893.js
+++ b/test/mjsunit/regress/regress-crbug-222893.js
@@ -61,4 +61,3 @@
g.apply(this, array);
g("a", "b", "c");
assertNull(error);
-
diff --git a/test/mjsunit/regress/regress-crbug-233737.js b/test/mjsunit/regress/regress-crbug-233737.js
index 835726b..38b44e0 100644
--- a/test/mjsunit/regress/regress-crbug-233737.js
+++ b/test/mjsunit/regress/regress-crbug-233737.js
@@ -39,4 +39,4 @@
assertEquals(1, hole(0));
assertEquals(1, hole(0));
%OptimizeFunctionOnNextCall(hole);
-assertEquals(0, hole(1));
\ No newline at end of file
+assertEquals(0, hole(1));
diff --git a/test/mjsunit/regress/regress-crbug-245480.js b/test/mjsunit/regress/regress-crbug-245480.js
index 4769486..1e7eb92 100644
--- a/test/mjsunit/regress/regress-crbug-245480.js
+++ b/test/mjsunit/regress/regress-crbug-245480.js
@@ -87,4 +87,4 @@
var b = [0];
g(b);
g(b);
-assertEquals(undefined, g(a));
\ No newline at end of file
+assertEquals(undefined, g(a));
diff --git a/test/mjsunit/regress/regress-crbug-259300.js b/test/mjsunit/regress/regress-crbug-259300.js
index c57b0e6..eac494a 100644
--- a/test/mjsunit/regress/regress-crbug-259300.js
+++ b/test/mjsunit/regress/regress-crbug-259300.js
@@ -46,4 +46,3 @@
eval("debugger");
Debug.setListener(null);
assertTrue(listened);
-
diff --git a/test/mjsunit/regress/regress-crbug-3184.js b/test/mjsunit/regress/regress-crbug-3184.js
index ed78183..054668e 100644
--- a/test/mjsunit/regress/regress-crbug-3184.js
+++ b/test/mjsunit/regress/regress-crbug-3184.js
@@ -80,4 +80,3 @@
});
assertEquals("Test1 test1", "test1 test1".cap());
assertEquals("Test2 Test2", "test2 test2".cap(true));
-
diff --git a/test/mjsunit/regress/regress-frame-details-null-receiver.js b/test/mjsunit/regress/regress-frame-details-null-receiver.js
index d15ed4d..ffe5fbb 100644
--- a/test/mjsunit/regress/regress-frame-details-null-receiver.js
+++ b/test/mjsunit/regress/regress-frame-details-null-receiver.js
@@ -49,4 +49,3 @@
Debug.setListener(null);
assertTrue(listened);
-
diff --git a/test/mjsunit/regress/regress-map-invalidation-1.js b/test/mjsunit/regress/regress-map-invalidation-1.js
index bcc6bbb..53f4c1e 100644
--- a/test/mjsunit/regress/regress-map-invalidation-1.js
+++ b/test/mjsunit/regress/regress-map-invalidation-1.js
@@ -45,4 +45,3 @@
}
f();
-
diff --git a/test/mjsunit/regress/regress-seqstrsetchar-ex1.js b/test/mjsunit/regress/regress-seqstrsetchar-ex1.js
index be54be6..c85cf56 100644
--- a/test/mjsunit/regress/regress-seqstrsetchar-ex1.js
+++ b/test/mjsunit/regress/regress-seqstrsetchar-ex1.js
@@ -57,4 +57,3 @@
%OptimizeFunctionOnNextCall(StringFromCharCode);
StringFromCharCode(0x7C, 0x7C);
StringFromCharCode(0xFFF, 0xFFF);
-
diff --git a/test/mjsunit/regress/regress-seqstrsetchar-ex2.js b/test/mjsunit/regress/regress-seqstrsetchar-ex2.js
index 6acc2f2..6a5ba91 100644
--- a/test/mjsunit/regress/regress-seqstrsetchar-ex2.js
+++ b/test/mjsunit/regress/regress-seqstrsetchar-ex2.js
@@ -32,4 +32,3 @@
%OptimizeFunctionOnNextCall(String.fromCharCode);
String.fromCharCode(0x7C, 0x7C);
String.fromCharCode(0xFFF, 0xFFF);
-
diff --git a/test/mjsunit/regress/regress-seqstrsetchar-ex3.js b/test/mjsunit/regress/regress-seqstrsetchar-ex3.js
index e2592a1..43d2b08 100644
--- a/test/mjsunit/regress/regress-seqstrsetchar-ex3.js
+++ b/test/mjsunit/regress/regress-seqstrsetchar-ex3.js
@@ -42,4 +42,3 @@
test();
%OptimizeFunctionOnNextCall(test);
test();
-
diff --git a/test/mjsunit/regress/regress-transcendental.js b/test/mjsunit/regress/regress-transcendental.js
index b5dbcb4..4065f50 100644
--- a/test/mjsunit/regress/regress-transcendental.js
+++ b/test/mjsunit/regress/regress-transcendental.js
@@ -46,4 +46,3 @@
test(Math.tan, -1.57079632679489660000, "Math.tan");
test(Math.sin, 6.283185307179586, "Math.sin");
-
diff --git a/test/mjsunit/simple-constructor.js b/test/mjsunit/simple-constructor.js
index e9ae921..391ef3d 100755
--- a/test/mjsunit/simple-constructor.js
+++ b/test/mjsunit/simple-constructor.js
@@ -137,4 +137,3 @@
o = new g();
assertEquals(1, o.x);
assertEquals(2, o.y);
-
diff --git a/test/mjsunit/sparse-array.js b/test/mjsunit/sparse-array.js
index 0952f2c..114ab0a 100644
--- a/test/mjsunit/sparse-array.js
+++ b/test/mjsunit/sparse-array.js
@@ -37,5 +37,3 @@
array[i * stride] = i;
}
}
-
-
diff --git a/test/mjsunit/stack-traces-2.js b/test/mjsunit/stack-traces-2.js
index 165c4df..3bec963 100644
--- a/test/mjsunit/stack-traces-2.js
+++ b/test/mjsunit/stack-traces-2.js
@@ -84,4 +84,4 @@
}, "QuickSort");
// Not omitted even though ADD from runtime.js is a non-native builtin.
-testNotOmittedBuiltin(function(){ thrower + 2; }, "ADD");
\ No newline at end of file
+testNotOmittedBuiltin(function(){ thrower + 2; }, "ADD");
diff --git a/test/mjsunit/stack-traces-custom-lazy.js b/test/mjsunit/stack-traces-custom-lazy.js
index 91d97f3..02a465e 100644
--- a/test/mjsunit/stack-traces-custom-lazy.js
+++ b/test/mjsunit/stack-traces-custom-lazy.js
@@ -46,4 +46,3 @@
testPrepareStackTrace(function() { throw new Error("foo"); });
testPrepareStackTrace(function f() { f(); });
-
diff --git a/test/mjsunit/store-dictionary.js b/test/mjsunit/store-dictionary.js
index 45e254b..377352f 100644
--- a/test/mjsunit/store-dictionary.js
+++ b/test/mjsunit/store-dictionary.js
@@ -62,4 +62,3 @@
delete o.x;
store(o);
assertEquals(42, o.x);
-
diff --git a/test/mjsunit/str-to-num.js b/test/mjsunit/str-to-num.js
index cbec87f..8c9a307 100644
--- a/test/mjsunit/str-to-num.js
+++ b/test/mjsunit/str-to-num.js
@@ -211,4 +211,4 @@
assertTrue(isNaN(toNumber("+0x012")));
assertTrue(isNaN(toNumber("-0x0")));
assertTrue(isNaN(toNumber("-0xFF")));
-assertTrue(isNaN(toNumber("-0x012")));
\ No newline at end of file
+assertTrue(isNaN(toNumber("-0x012")));
diff --git a/test/mjsunit/strict-equals.js b/test/mjsunit/strict-equals.js
index d080ce8..d5577c7 100644
--- a/test/mjsunit/strict-equals.js
+++ b/test/mjsunit/strict-equals.js
@@ -84,7 +84,3 @@
assertFalse(1 === new Number(1));
assertTrue(4.2 === 4.2);
assertTrue(4.2 === Number(4.2));
-
-
-
-
diff --git a/test/mjsunit/string-natives.js b/test/mjsunit/string-natives.js
index cd1cde1..7a9009b 100644
--- a/test/mjsunit/string-natives.js
+++ b/test/mjsunit/string-natives.js
@@ -77,4 +77,3 @@
test();
%OptimizeFunctionOnNextCall(test);
test();
-
diff --git a/test/mjsunit/string-replace-gc.js b/test/mjsunit/string-replace-gc.js
index 73b310f..2f1efd8 100644
--- a/test/mjsunit/string-replace-gc.js
+++ b/test/mjsunit/string-replace-gc.js
@@ -53,4 +53,3 @@
var bar = foo.replace(/[a]/g, moving_string);
print(bar.length);
-
diff --git a/test/mjsunit/string-search.js b/test/mjsunit/string-search.js
index 4de17bc..037725b 100644
--- a/test/mjsunit/string-search.js
+++ b/test/mjsunit/string-search.js
@@ -37,4 +37,3 @@
var r = s.search(s);
assertEquals(0, r);
}
-
diff --git a/test/mjsunit/string-slices.js b/test/mjsunit/string-slices.js
index 5b1dc36..f5e1d91 100755
--- a/test/mjsunit/string-slices.js
+++ b/test/mjsunit/string-slices.js
@@ -222,4 +222,4 @@
test_crankshaft();
%OptimizeFunctionOnNextCall(test_crankshaft);
-test_crankshaft();
\ No newline at end of file
+test_crankshaft();
diff --git a/test/mjsunit/to-precision.js b/test/mjsunit/to-precision.js
index 04c7d76..ded7185 100644
--- a/test/mjsunit/to-precision.js
+++ b/test/mjsunit/to-precision.js
@@ -79,4 +79,3 @@
assertEquals("-91.1234", (-91.1234).toPrecision(6));
assertEquals("-91.12340", (-91.1234).toPrecision(7));
assertEquals("-91.123400", (-91.1234).toPrecision(8));
-
diff --git a/test/mjsunit/tobool.js b/test/mjsunit/tobool.js
index 65bffb6..44a5a3c 100644
--- a/test/mjsunit/tobool.js
+++ b/test/mjsunit/tobool.js
@@ -32,5 +32,3 @@
assertTrue(!!new Number(-1), "new Number(-1)");
assertTrue(!!new Number(0), "new Number(0)");
assertTrue(!!new Number(1), "new Number(1)");
-
-
diff --git a/test/mjsunit/tools/profile.js b/test/mjsunit/tools/profile.js
index 4df1a08..0f79aea 100644
--- a/test/mjsunit/tools/profile.js
+++ b/test/mjsunit/tools/profile.js
@@ -345,4 +345,3 @@
}
})();
-
diff --git a/test/mjsunit/touint32.js b/test/mjsunit/touint32.js
index f06bddf..9c4cc36 100644
--- a/test/mjsunit/touint32.js
+++ b/test/mjsunit/touint32.js
@@ -68,5 +68,3 @@
assertEquals(4294967295, ToUInt32('4294967295'), "'4294967295'");
assertEquals(0, ToUInt32('4294967296'), "'4294967296'");
assertEquals(1, ToUInt32('4294967297'), "'4294967297'");
-
-
diff --git a/test/mjsunit/transcendentals.js b/test/mjsunit/transcendentals.js
index 78e6c48..2a75d6d 100644
--- a/test/mjsunit/transcendentals.js
+++ b/test/mjsunit/transcendentals.js
@@ -46,4 +46,3 @@
assertTrue(Math.atan(x) != Math.atan(y));
assertTrue(Math.exp(x) != Math.exp(y));
-
diff --git a/test/mjsunit/try-finally-continue.js b/test/mjsunit/try-finally-continue.js
index b55e7ac..5e04930 100644
--- a/test/mjsunit/try-finally-continue.js
+++ b/test/mjsunit/try-finally-continue.js
@@ -69,4 +69,4 @@
}
}
}
-assertEquals(9, f);
\ No newline at end of file
+assertEquals(9, f);
diff --git a/test/mjsunit/unicode-string-to-number.js b/test/mjsunit/unicode-string-to-number.js
index 13a7acf..2376a60 100644
--- a/test/mjsunit/unicode-string-to-number.js
+++ b/test/mjsunit/unicode-string-to-number.js
@@ -43,4 +43,3 @@
s += s;
}
assertTrue(isNaN(Number(s)), "long-string");
-
diff --git a/test/mjsunit/unicode-test.js b/test/mjsunit/unicode-test.js
index 66a029a..5be1b41 100644
--- a/test/mjsunit/unicode-test.js
+++ b/test/mjsunit/unicode-test.js
@@ -9165,5 +9165,3 @@
var thai_l_regexp2 = new RegExp("[" + thai_l_thingy + "]");
assertTrue(thai_l_regexp.test(thai_l_thingy));
assertTrue(thai_l_regexp2.test(thai_l_thingy));
-
-
diff --git a/test/mjsunit/with-value.js b/test/mjsunit/with-value.js
index a4da1fa..f7a89f3 100644
--- a/test/mjsunit/with-value.js
+++ b/test/mjsunit/with-value.js
@@ -35,4 +35,4 @@
/* This should be fairly easy again. May need some work in the
compiler's VisitWith() function, or perhaps the runtime routine's
PushContextForWith().
-*/
\ No newline at end of file
+*/
diff --git a/test/preparser/non-use-strict-hex-escape.js b/test/preparser/non-use-strict-hex-escape.js
index bf28923..44db66e 100644
--- a/test/preparser/non-use-strict-hex-escape.js
+++ b/test/preparser/non-use-strict-hex-escape.js
@@ -32,4 +32,4 @@
"use\x20strict";
var x = "hello\040world";
return x;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/non-use-strict-octal-escape.js b/test/preparser/non-use-strict-octal-escape.js
index 9e00742..55f035a 100644
--- a/test/preparser/non-use-strict-octal-escape.js
+++ b/test/preparser/non-use-strict-octal-escape.js
@@ -32,4 +32,4 @@
"use\040strict";
var x = "hello\040world";
return x;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/non-use-strict-uhex-escape.js b/test/preparser/non-use-strict-uhex-escape.js
index 5fba673..c7df2cb 100644
--- a/test/preparser/non-use-strict-uhex-escape.js
+++ b/test/preparser/non-use-strict-uhex-escape.js
@@ -32,4 +32,4 @@
"use\u0020strict";
var x = "hello\040world";
return x;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/nonstrict-arguments.js b/test/preparser/nonstrict-arguments.js
index 890f62e..43c7e2e 100644
--- a/test/preparser/nonstrict-arguments.js
+++ b/test/preparser/nonstrict-arguments.js
@@ -48,4 +48,3 @@
arguments *= arguments--;
function arguments(arguments) {};
try {} catch (arguments) {}
-
diff --git a/test/preparser/nonstrict-eval.js b/test/preparser/nonstrict-eval.js
index ad994ab..db6feda 100644
--- a/test/preparser/nonstrict-eval.js
+++ b/test/preparser/nonstrict-eval.js
@@ -48,4 +48,3 @@
eval *= eval--;
function eval(eval) {};
try {} catch (eval) {}
-
diff --git a/test/preparser/nonstrict-with.js b/test/preparser/nonstrict-with.js
index 12d05a0..17f0c93 100644
--- a/test/preparser/nonstrict-with.js
+++ b/test/preparser/nonstrict-with.js
@@ -38,6 +38,3 @@
}
with ({}) {}
-
-
-
diff --git a/test/preparser/strict-const.js b/test/preparser/strict-const.js
index 91e9e39..2b9230c 100644
--- a/test/preparser/strict-const.js
+++ b/test/preparser/strict-const.js
@@ -26,4 +26,4 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"use strict";
-const x = 42;
\ No newline at end of file
+const x = 42;
diff --git a/test/preparser/strict-octal-indirect-regexp.js b/test/preparser/strict-octal-indirect-regexp.js
index 122bd3d..ea5c5e3 100644
--- a/test/preparser/strict-octal-indirect-regexp.js
+++ b/test/preparser/strict-octal-indirect-regexp.js
@@ -31,4 +31,4 @@
"use strict";
var re = RegExp("Hello\\040World");
return re;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/strict-octal-number.js b/test/preparser/strict-octal-number.js
index d387d6a..3e99127 100644
--- a/test/preparser/strict-octal-number.js
+++ b/test/preparser/strict-octal-number.js
@@ -31,4 +31,4 @@
"use strict";
var x = 012;
return x;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/strict-octal-regexp.js b/test/preparser/strict-octal-regexp.js
index fded9bf..b39d0b2 100644
--- a/test/preparser/strict-octal-regexp.js
+++ b/test/preparser/strict-octal-regexp.js
@@ -31,4 +31,4 @@
"use strict";
var re = /hello\040world/;
return re;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/strict-octal-string.js b/test/preparser/strict-octal-string.js
index 40408e6..87c0e99 100644
--- a/test/preparser/strict-octal-string.js
+++ b/test/preparser/strict-octal-string.js
@@ -31,4 +31,4 @@
"use strict";
var x = "hello\040world";
return x;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/strict-octal-use-strict-after.js b/test/preparser/strict-octal-use-strict-after.js
index 1af078a..57d0f20 100644
--- a/test/preparser/strict-octal-use-strict-after.js
+++ b/test/preparser/strict-octal-use-strict-after.js
@@ -32,4 +32,4 @@
"use strict";
"use\040strict";
return true;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/strict-octal-use-strict-before.js b/test/preparser/strict-octal-use-strict-before.js
index 1dbb571..bfc380f 100644
--- a/test/preparser/strict-octal-use-strict-before.js
+++ b/test/preparser/strict-octal-use-strict-before.js
@@ -32,4 +32,4 @@
"use\040strict";
"use strict";
return true;
-}
\ No newline at end of file
+}
diff --git a/test/preparser/strict-with.js b/test/preparser/strict-with.js
index a19355e..411fc29 100644
--- a/test/preparser/strict-with.js
+++ b/test/preparser/strict-with.js
@@ -30,4 +30,4 @@
function foo() {
"use strict";
with ({}) {}
-}
\ No newline at end of file
+}
diff --git a/test/webkit/arguments-bad-index.js b/test/webkit/arguments-bad-index.js
index a4dd4d5..28a4fd6 100644
--- a/test/webkit/arguments-bad-index.js
+++ b/test/webkit/arguments-bad-index.js
@@ -34,4 +34,3 @@
shouldBe('indexArguments("1 ", "a")', 'undefined');
shouldBe('indexArguments(0xDEADBEEF)', 'undefined');
shouldBe('indexArguments(0xFFFFFFFF)', 'undefined');
-
diff --git a/test/webkit/concat-while-having-a-bad-time.js b/test/webkit/concat-while-having-a-bad-time.js
index dfda1e0..2c29917 100644
--- a/test/webkit/concat-while-having-a-bad-time.js
+++ b/test/webkit/concat-while-having-a-bad-time.js
@@ -27,5 +27,3 @@
Object.defineProperty(Array.prototype, 0, { writable: false });
shouldBe("[42].concat()", "[42]");
-
-
diff --git a/test/webkit/dfg-abs-backwards-propagation.js b/test/webkit/dfg-abs-backwards-propagation.js
index 828e2d6..1685ba0 100644
--- a/test/webkit/dfg-abs-backwards-propagation.js
+++ b/test/webkit/dfg-abs-backwards-propagation.js
@@ -46,4 +46,3 @@
}
shouldBe("foo(" + f + ", " + array + ", 0)", expected);
}
-
diff --git a/test/webkit/dfg-add-not-number.js b/test/webkit/dfg-add-not-number.js
index df6dcdf..1d37646 100644
--- a/test/webkit/dfg-add-not-number.js
+++ b/test/webkit/dfg-add-not-number.js
@@ -32,4 +32,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("foo(\"foo\" + i)", "NaN");
-
diff --git a/test/webkit/dfg-arguments-alias-escape.js b/test/webkit/dfg-arguments-alias-escape.js
index f7a012e..dce0c3d 100644
--- a/test/webkit/dfg-arguments-alias-escape.js
+++ b/test/webkit/dfg-arguments-alias-escape.js
@@ -40,4 +40,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("bar(42)", "1764");
-
diff --git a/test/webkit/dfg-arguments-alias-one-block-overwrite.js b/test/webkit/dfg-arguments-alias-one-block-overwrite.js
index e94ad8b..33154e9 100644
--- a/test/webkit/dfg-arguments-alias-one-block-overwrite.js
+++ b/test/webkit/dfg-arguments-alias-one-block-overwrite.js
@@ -42,4 +42,3 @@
var c = i + 3;
shouldBe("foo(a, b, c)", "6");
}
-
diff --git a/test/webkit/dfg-arguments-alias.js b/test/webkit/dfg-arguments-alias.js
index c30fe89..6fc7195 100644
--- a/test/webkit/dfg-arguments-alias.js
+++ b/test/webkit/dfg-arguments-alias.js
@@ -39,4 +39,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("bar(42)", "42");
-
diff --git a/test/webkit/dfg-arguments-mixed-alias.js b/test/webkit/dfg-arguments-mixed-alias.js
index 477eac3..7d52ffb 100644
--- a/test/webkit/dfg-arguments-mixed-alias.js
+++ b/test/webkit/dfg-arguments-mixed-alias.js
@@ -39,4 +39,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("bar(42)", "42");
-
diff --git a/test/webkit/dfg-arguments-out-of-bounds.js b/test/webkit/dfg-arguments-out-of-bounds.js
index 8774d2c..e6e9a01 100644
--- a/test/webkit/dfg-arguments-out-of-bounds.js
+++ b/test/webkit/dfg-arguments-out-of-bounds.js
@@ -49,4 +49,3 @@
result = "" +foo.apply(void 0, args);
shouldBe("result", expected);
}
-
diff --git a/test/webkit/dfg-arith-add-overflow-check-elimination-predicted-but-not-proven-int.js b/test/webkit/dfg-arith-add-overflow-check-elimination-predicted-but-not-proven-int.js
index 54c049f..ecd2ed2 100644
--- a/test/webkit/dfg-arith-add-overflow-check-elimination-predicted-but-not-proven-int.js
+++ b/test/webkit/dfg-arith-add-overflow-check-elimination-predicted-but-not-proven-int.js
@@ -64,4 +64,3 @@
}
shouldBe("bar(" + a + ", " + b + ", {f:" + c + "})", "" + expected);
}
-
diff --git a/test/webkit/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js b/test/webkit/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js
index 292926e..718fa5e 100644
--- a/test/webkit/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js
+++ b/test/webkit/dfg-arith-add-overflow-check-elimination-tower-of-large-numbers.js
@@ -57,4 +57,3 @@
}
shouldBe("bar(" + a + ", " + b + ")", "" + expected);
}
-
diff --git a/test/webkit/dfg-array-dead.js b/test/webkit/dfg-array-dead.js
index a627617..c40a37c 100644
--- a/test/webkit/dfg-array-dead.js
+++ b/test/webkit/dfg-array-dead.js
@@ -49,4 +49,3 @@
for (var i = 0; i < 1000; ++i) {
shouldBe("foo()", "2");
}
-
diff --git a/test/webkit/dfg-array-length-dead.js b/test/webkit/dfg-array-length-dead.js
index 5256fe1..9191524 100644
--- a/test/webkit/dfg-array-length-dead.js
+++ b/test/webkit/dfg-array-length-dead.js
@@ -33,4 +33,3 @@
for (var i = 0; i < 1000; ++i) {
shouldBe("foo({f:[]})", "42");
}
-
diff --git a/test/webkit/dfg-branch-logical-not-peephole-around-osr-exit.js b/test/webkit/dfg-branch-logical-not-peephole-around-osr-exit.js
index ab0215e..9e92c24 100644
--- a/test/webkit/dfg-branch-logical-not-peephole-around-osr-exit.js
+++ b/test/webkit/dfg-branch-logical-not-peephole-around-osr-exit.js
@@ -39,4 +39,3 @@
var expected = i + (i == 199 ? 2147483647 : 5) + (i !== 5 ? 1 : -1)
shouldBe("foo(i, 5, i == 199 ? 2147483647 : 5)", "" + expected);
}
-
diff --git a/test/webkit/dfg-branch-not-fail.js b/test/webkit/dfg-branch-not-fail.js
index af7ba97..31de5af 100644
--- a/test/webkit/dfg-branch-not-fail.js
+++ b/test/webkit/dfg-branch-not-fail.js
@@ -51,4 +51,3 @@
shouldBe("bar({f:True})", "0");
shouldBe("bar({f:False})", "1");
}
-
diff --git a/test/webkit/dfg-call-function-hit-watchpoint.js b/test/webkit/dfg-call-function-hit-watchpoint.js
index 5a332c1..6ee1f68 100644
--- a/test/webkit/dfg-call-function-hit-watchpoint.js
+++ b/test/webkit/dfg-call-function-hit-watchpoint.js
@@ -43,4 +43,3 @@
expected = -1;
shouldBe("bar(i, i + 1)", "" + expected);
}
-
diff --git a/test/webkit/dfg-call-method-hit-watchpoint.js b/test/webkit/dfg-call-method-hit-watchpoint.js
index 382f899..8c486c7 100644
--- a/test/webkit/dfg-call-method-hit-watchpoint.js
+++ b/test/webkit/dfg-call-method-hit-watchpoint.js
@@ -50,4 +50,3 @@
expected = 56;
shouldBe("callFoo(o)", "" + expected);
}
-
diff --git a/test/webkit/dfg-cfa-prove-put-by-id-simple-when-storing-to-specialized-function.js b/test/webkit/dfg-cfa-prove-put-by-id-simple-when-storing-to-specialized-function.js
index 6953ffa..870b73d 100644
--- a/test/webkit/dfg-cfa-prove-put-by-id-simple-when-storing-to-specialized-function.js
+++ b/test/webkit/dfg-cfa-prove-put-by-id-simple-when-storing-to-specialized-function.js
@@ -52,4 +52,3 @@
}
shouldBe("bar.call({f:baz}, fuzz)", "\"fuzz\"");
-
diff --git a/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null-and-decrement.js b/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null-and-decrement.js
index cac2d10..aea028d 100644
--- a/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null-and-decrement.js
+++ b/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null-and-decrement.js
@@ -51,5 +51,3 @@
}
shouldBe("foo(o)", expected);
}
-
-
diff --git a/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null.js b/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null.js
index 7226424..f2312bd 100644
--- a/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null.js
+++ b/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-branch-not-null.js
@@ -49,4 +49,3 @@
}
shouldBe("foo(o)", expected);
}
-
diff --git a/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-typeof.js b/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-typeof.js
index bb4fee9..c422d31 100644
--- a/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-typeof.js
+++ b/test/webkit/dfg-cfg-simplify-eliminate-set-local-type-check-then-typeof.js
@@ -51,4 +51,3 @@
shouldBe("result[0]", expectedFirst);
shouldBe("result[1]", expectedSecond);
}
-
diff --git a/test/webkit/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js b/test/webkit/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js
index 65be965..73daacd 100644
--- a/test/webkit/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js
+++ b/test/webkit/dfg-cfg-simplify-phantom-get-local-on-same-block-set-local.js
@@ -60,4 +60,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("thingy(o)", "42");
-
diff --git a/test/webkit/dfg-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js b/test/webkit/dfg-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js
index 8b986a1..491dda1 100644
--- a/test/webkit/dfg-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js
+++ b/test/webkit/dfg-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js
@@ -36,4 +36,3 @@
} else
shouldThrow("foo({f:42}, null)");
}
-
diff --git a/test/webkit/dfg-compare-final-object-to-final-object-or-other-when-proven-final-object.js b/test/webkit/dfg-compare-final-object-to-final-object-or-other-when-proven-final-object.js
index f49eed9..4b1694b 100644
--- a/test/webkit/dfg-compare-final-object-to-final-object-or-other-when-proven-final-object.js
+++ b/test/webkit/dfg-compare-final-object-to-final-object-or-other-when-proven-final-object.js
@@ -36,4 +36,3 @@
} else
shouldThrow("foo({f:42}, null)");
}
-
diff --git a/test/webkit/dfg-constant-fold-first-local-read-after-block-merge.js b/test/webkit/dfg-constant-fold-first-local-read-after-block-merge.js
index 3969242..85ae201 100644
--- a/test/webkit/dfg-constant-fold-first-local-read-after-block-merge.js
+++ b/test/webkit/dfg-constant-fold-first-local-read-after-block-merge.js
@@ -44,4 +44,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("bar(5)", "42");
-
diff --git a/test/webkit/dfg-constant-fold-logical-not-branch.js b/test/webkit/dfg-constant-fold-logical-not-branch.js
index 6a91b14..bb48f63 100644
--- a/test/webkit/dfg-constant-fold-logical-not-branch.js
+++ b/test/webkit/dfg-constant-fold-logical-not-branch.js
@@ -51,5 +51,3 @@
shouldBe("foo1(new Stuff())", "43");
shouldBe("foo2(new Stuff())", "58");
}
-
-
diff --git a/test/webkit/dfg-constant-fold-misprediction.js b/test/webkit/dfg-constant-fold-misprediction.js
index cd73f70..9760e4f 100644
--- a/test/webkit/dfg-constant-fold-misprediction.js
+++ b/test/webkit/dfg-constant-fold-misprediction.js
@@ -56,5 +56,3 @@
// Call foo() enough times to make totally sure that we optimize.
for (var i = 0; i < 5; ++i)
shouldBe("foo(0.5)", "1000.50025");
-
-
diff --git a/test/webkit/dfg-cse-cfa-discrepancy.js b/test/webkit/dfg-cse-cfa-discrepancy.js
index a40e7e6..5617765 100644
--- a/test/webkit/dfg-cse-cfa-discrepancy.js
+++ b/test/webkit/dfg-cse-cfa-discrepancy.js
@@ -51,4 +51,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("foo(i, i + 1)", "162");
-
diff --git a/test/webkit/dfg-cse-dead-get-scoped-var.js b/test/webkit/dfg-cse-dead-get-scoped-var.js
index aec600b..de18191 100644
--- a/test/webkit/dfg-cse-dead-get-scoped-var.js
+++ b/test/webkit/dfg-cse-dead-get-scoped-var.js
@@ -38,4 +38,3 @@
for (var i = 0; i < 1000; ++i)
shouldBe("foo(i)(false)", "42");
-
diff --git a/test/webkit/dfg-dead-min-one-arg.js b/test/webkit/dfg-dead-min-one-arg.js
index 48293be..3195f5b 100644
--- a/test/webkit/dfg-dead-min-one-arg.js
+++ b/test/webkit/dfg-dead-min-one-arg.js
@@ -44,4 +44,3 @@
shouldBe("ok", "" + i);
shouldBe("result", "" + expected);
}
-
diff --git a/test/webkit/dfg-dead-min-two-args.js b/test/webkit/dfg-dead-min-two-args.js
index f723f43..d5b2a50 100644
--- a/test/webkit/dfg-dead-min-two-args.js
+++ b/test/webkit/dfg-dead-min-two-args.js
@@ -67,4 +67,3 @@
shouldBe("ok", "" + i);
shouldBe("result", "100");
}
-
diff --git a/test/webkit/dfg-dead-speculation.js b/test/webkit/dfg-dead-speculation.js
index 7778f5a..71cdd0f 100644
--- a/test/webkit/dfg-dead-speculation.js
+++ b/test/webkit/dfg-dead-speculation.js
@@ -42,4 +42,3 @@
shouldBe("foo(thingy, i)", "10");
shouldBe("variable", "" + expected);
}
-
diff --git a/test/webkit/dfg-dead-variable-on-exit.js b/test/webkit/dfg-dead-variable-on-exit.js
index 0f9f48c..bc4c9ea 100644
--- a/test/webkit/dfg-dead-variable-on-exit.js
+++ b/test/webkit/dfg-dead-variable-on-exit.js
@@ -84,4 +84,3 @@
code += "); foo(firstArg, secondArg)";
shouldBe(code, "1");
}
-
diff --git a/test/webkit/dfg-double-use-of-post-simplification-double-prediction.js b/test/webkit/dfg-double-use-of-post-simplification-double-prediction.js
index cf38579..2c11eb1 100644
--- a/test/webkit/dfg-double-use-of-post-simplification-double-prediction.js
+++ b/test/webkit/dfg-double-use-of-post-simplification-double-prediction.js
@@ -37,4 +37,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("foo(0.5)", "42.5");
-
diff --git a/test/webkit/dfg-double-vote-fuzz.js b/test/webkit/dfg-double-vote-fuzz.js
index 266bc15..722341a 100644
--- a/test/webkit/dfg-double-vote-fuzz.js
+++ b/test/webkit/dfg-double-vote-fuzz.js
@@ -87,5 +87,3 @@
}
shouldBe("grandResult", "14578304");
-
-
diff --git a/test/webkit/dfg-ensure-non-array-array-storage-on-window.js b/test/webkit/dfg-ensure-non-array-array-storage-on-window.js
index 3ae47c5..11e9fbd 100644
--- a/test/webkit/dfg-ensure-non-array-array-storage-on-window.js
+++ b/test/webkit/dfg-ensure-non-array-array-storage-on-window.js
@@ -85,4 +85,3 @@
shouldBe("foo(w)", "1");
w.length = 2;
shouldBe("foo(w)", "0/0");
-
diff --git a/test/webkit/dfg-get-by-val-clobber.js b/test/webkit/dfg-get-by-val-clobber.js
index c6c57fe..19d0091 100644
--- a/test/webkit/dfg-get-by-val-clobber.js
+++ b/test/webkit/dfg-get-by-val-clobber.js
@@ -49,4 +49,3 @@
// Undo.
array1[0] = 1;
}
-
diff --git a/test/webkit/dfg-getter-throw.js b/test/webkit/dfg-getter-throw.js
index c77b33d..2632242 100644
--- a/test/webkit/dfg-getter-throw.js
+++ b/test/webkit/dfg-getter-throw.js
@@ -47,5 +47,3 @@
});
shouldBe("bar(o)", i < 100 ? "\"Returned result: " + i + "\"" : "\"Threw exception: Oh hi, I'm an exception!\"");
}
-
-
diff --git a/test/webkit/dfg-getter.js b/test/webkit/dfg-getter.js
index dafd9f9..d0f5664 100644
--- a/test/webkit/dfg-getter.js
+++ b/test/webkit/dfg-getter.js
@@ -34,5 +34,3 @@
o.__defineGetter__("f", function(){ return i; });
shouldBe("foo(o)", "" + i);
}
-
-
diff --git a/test/webkit/dfg-holy-put-by-val-interferes-with-get-array-length.js b/test/webkit/dfg-holy-put-by-val-interferes-with-get-array-length.js
index 684ebe8..4b83711 100644
--- a/test/webkit/dfg-holy-put-by-val-interferes-with-get-array-length.js
+++ b/test/webkit/dfg-holy-put-by-val-interferes-with-get-array-length.js
@@ -33,5 +33,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("foo([75])", "[1,2]");
-
-
diff --git a/test/webkit/dfg-inline-arguments-osr-exit-and-capture.js b/test/webkit/dfg-inline-arguments-osr-exit-and-capture.js
index 82a49fa..4d254d8 100644
--- a/test/webkit/dfg-inline-arguments-osr-exit-and-capture.js
+++ b/test/webkit/dfg-inline-arguments-osr-exit-and-capture.js
@@ -53,4 +53,3 @@
}
shouldBe("baz(arg1, arg2)", "" + expected);
}
-
diff --git a/test/webkit/dfg-inline-arguments-out-of-bounds.js b/test/webkit/dfg-inline-arguments-out-of-bounds.js
index 23b9184..9cd6ec0 100644
--- a/test/webkit/dfg-inline-arguments-out-of-bounds.js
+++ b/test/webkit/dfg-inline-arguments-out-of-bounds.js
@@ -50,4 +50,3 @@
result = "" + bar();
shouldBe("result", expected);
}
-
diff --git a/test/webkit/dfg-inline-arguments-use-directly-from-inlined-code.js b/test/webkit/dfg-inline-arguments-use-directly-from-inlined-code.js
index a1c5ca2..95a98bc 100644
--- a/test/webkit/dfg-inline-arguments-use-directly-from-inlined-code.js
+++ b/test/webkit/dfg-inline-arguments-use-directly-from-inlined-code.js
@@ -45,4 +45,3 @@
for (var __i = 0; __i < 200; ++__i)
shouldBe("argsToStr(bar(\"a\" + __i, \"b\" + __i, \"c\" + __i))", "\"[object Arguments]: a" + __i + ", b" + __i + ", c" + __i + "\"");
-
diff --git a/test/webkit/dfg-inline-arguments-use-from-all-the-places-broken.js b/test/webkit/dfg-inline-arguments-use-from-all-the-places-broken.js
index b4fa6c1..cc22ec4 100644
--- a/test/webkit/dfg-inline-arguments-use-from-all-the-places-broken.js
+++ b/test/webkit/dfg-inline-arguments-use-from-all-the-places-broken.js
@@ -58,4 +58,3 @@
for (var __i = 0; __i < 200; ++__i)
shouldThrow("argsToStr(bar(\"a\" + __i, \"b\" + __i, \"c\" + __i))");
-
diff --git a/test/webkit/dfg-inline-arguments-use-from-all-the-places.js b/test/webkit/dfg-inline-arguments-use-from-all-the-places.js
index 4470d9c..fce5430 100644
--- a/test/webkit/dfg-inline-arguments-use-from-all-the-places.js
+++ b/test/webkit/dfg-inline-arguments-use-from-all-the-places.js
@@ -62,4 +62,3 @@
var text3 = "[[object Arguments]: 42, 56]";
shouldBe("argsToStr(bar(o, \"b\" + __i, \"c\" + __i))", "\"[[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments],[object Arguments]: " + text1 + ", " + text1 + ", " + text1 + ", " + text1 + ", " + text1 + ", " + text2 + ", " + text1 + ", " + text1 + ", " + text2 + ", " + text3 + "]\"");
}
-
diff --git a/test/webkit/dfg-inline-arguments-use-from-getter.js b/test/webkit/dfg-inline-arguments-use-from-getter.js
index f532d35..bece496 100644
--- a/test/webkit/dfg-inline-arguments-use-from-getter.js
+++ b/test/webkit/dfg-inline-arguments-use-from-getter.js
@@ -48,4 +48,3 @@
for (var __i = 0; __i < 200; ++__i)
shouldBe("argsToStr(bar(o, \"b\" + __i, \"c\" + __i))", "\"[object Arguments]: [object Object], b" + __i + ", c" + __i + "\"");
-
diff --git a/test/webkit/dfg-inline-function-dot-caller.js b/test/webkit/dfg-inline-function-dot-caller.js
index c6dd2b2..dbbefb8 100644
--- a/test/webkit/dfg-inline-function-dot-caller.js
+++ b/test/webkit/dfg-inline-function-dot-caller.js
@@ -66,4 +66,3 @@
shouldBe("resultArray[2]", "\"makeInlinableCall\"");
shouldBe("resultArray[1]", "\"inlineable\"");
shouldBe("resultArray[0]", "\"nonInlineable\"");
-
diff --git a/test/webkit/dfg-inline-unused-this-method-check.js b/test/webkit/dfg-inline-unused-this-method-check.js
index 929592e..13ad448 100644
--- a/test/webkit/dfg-inline-unused-this-method-check.js
+++ b/test/webkit/dfg-inline-unused-this-method-check.js
@@ -51,4 +51,3 @@
shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + i + i * 2));
}
-
diff --git a/test/webkit/dfg-inline-unused-this.js b/test/webkit/dfg-inline-unused-this.js
index 5983d72..8260083 100644
--- a/test/webkit/dfg-inline-unused-this.js
+++ b/test/webkit/dfg-inline-unused-this.js
@@ -54,4 +54,3 @@
shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + i + i * 2));
}
-
diff --git a/test/webkit/dfg-int-overflow-in-loop.js b/test/webkit/dfg-int-overflow-in-loop.js
index 8752a12..07b8e34 100644
--- a/test/webkit/dfg-int-overflow-in-loop.js
+++ b/test/webkit/dfg-int-overflow-in-loop.js
@@ -37,4 +37,3 @@
}
shouldBe("foo(0)", "-4094336");
-
diff --git a/test/webkit/dfg-int-overflow-large-constants-in-a-line.js b/test/webkit/dfg-int-overflow-large-constants-in-a-line.js
index 4e2f970..dc6ff09 100644
--- a/test/webkit/dfg-int-overflow-large-constants-in-a-line.js
+++ b/test/webkit/dfg-int-overflow-large-constants-in-a-line.js
@@ -72,5 +72,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("foo(2147483647)", "2147483552");
-
-
diff --git a/test/webkit/dfg-integer-optimization.js b/test/webkit/dfg-integer-optimization.js
index 31ec8fc..0041aec 100644
--- a/test/webkit/dfg-integer-optimization.js
+++ b/test/webkit/dfg-integer-optimization.js
@@ -43,4 +43,3 @@
shouldBe("result.a", "" + eval("((" + a + " + " + b + ") | 0)"))
shouldBe("result.b", "" + eval(a + " + " + b))
}
-
diff --git a/test/webkit/dfg-intrinsic-side-effect-assignment-osr-exit.js b/test/webkit/dfg-intrinsic-side-effect-assignment-osr-exit.js
index 4a32738..f8316af 100644
--- a/test/webkit/dfg-intrinsic-side-effect-assignment-osr-exit.js
+++ b/test/webkit/dfg-intrinsic-side-effect-assignment-osr-exit.js
@@ -46,4 +46,3 @@
}
shouldBe("foo(array)", expected);
}
-
diff --git a/test/webkit/dfg-intrinsic-unused-this-method-check.js b/test/webkit/dfg-intrinsic-unused-this-method-check.js
index 4424400..445cb0b 100644
--- a/test/webkit/dfg-intrinsic-unused-this-method-check.js
+++ b/test/webkit/dfg-intrinsic-unused-this-method-check.js
@@ -47,4 +47,3 @@
shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + Math.max(i, i * 2)));
}
-
diff --git a/test/webkit/dfg-intrinsic-unused-this.js b/test/webkit/dfg-intrinsic-unused-this.js
index f7d3aa5..fa20868 100644
--- a/test/webkit/dfg-intrinsic-unused-this.js
+++ b/test/webkit/dfg-intrinsic-unused-this.js
@@ -50,4 +50,3 @@
shouldBe("baz(object, " + i + ", " + (i * 2) + ")", "" + (offset + Math.max(i, i * 2)));
}
-
diff --git a/test/webkit/dfg-max-backwards-propagation.js b/test/webkit/dfg-max-backwards-propagation.js
index b4041e1..0fd18fb 100644
--- a/test/webkit/dfg-max-backwards-propagation.js
+++ b/test/webkit/dfg-max-backwards-propagation.js
@@ -46,4 +46,3 @@
}
shouldBe("foo(" + f + ", " + array + ", 0)", expected);
}
-
diff --git a/test/webkit/dfg-min-backwards-propagation.js b/test/webkit/dfg-min-backwards-propagation.js
index 835aefa..b423a8f 100644
--- a/test/webkit/dfg-min-backwards-propagation.js
+++ b/test/webkit/dfg-min-backwards-propagation.js
@@ -46,4 +46,3 @@
}
shouldBe("foo(" + f + ", " + array + ", 0)", expected);
}
-
diff --git a/test/webkit/dfg-mispredict-variable-but-prove-int.js b/test/webkit/dfg-mispredict-variable-but-prove-int.js
index c312670..47530c6 100644
--- a/test/webkit/dfg-mispredict-variable-but-prove-int.js
+++ b/test/webkit/dfg-mispredict-variable-but-prove-int.js
@@ -41,4 +41,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("foo(i, i + 1, i + 2)", "1");
-
diff --git a/test/webkit/dfg-mul-big-integer-with-small-integer-and-bitor.js b/test/webkit/dfg-mul-big-integer-with-small-integer-and-bitor.js
index 51401ea..bdb4ecf 100644
--- a/test/webkit/dfg-mul-big-integer-with-small-integer-and-bitor.js
+++ b/test/webkit/dfg-mul-big-integer-with-small-integer-and-bitor.js
@@ -31,6 +31,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("foo(2147483647)", "-65536");
-
-
-
diff --git a/test/webkit/dfg-mul-big-integer-with-small-integer-and-detect-overflow.js b/test/webkit/dfg-mul-big-integer-with-small-integer-and-detect-overflow.js
index 65ed8b7..b891794 100644
--- a/test/webkit/dfg-mul-big-integer-with-small-integer-and-detect-overflow.js
+++ b/test/webkit/dfg-mul-big-integer-with-small-integer-and-detect-overflow.js
@@ -31,5 +31,3 @@
for (var i = 0; i < 1000; ++i)
shouldBe("foo(2147483647)", "140737488289792");
-
-
diff --git a/test/webkit/dfg-mul-big-integers.js b/test/webkit/dfg-mul-big-integers.js
index 0176a25..2dbd30d 100644
--- a/test/webkit/dfg-mul-big-integers.js
+++ b/test/webkit/dfg-mul-big-integers.js
@@ -31,5 +31,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("foo(2147483647, 2147483646)", "-2147483648");
-
-
diff --git a/test/webkit/dfg-multi-basic-block-structure-clobber.js b/test/webkit/dfg-multi-basic-block-structure-clobber.js
index a4d8bdb..741a608 100644
--- a/test/webkit/dfg-multi-basic-block-structure-clobber.js
+++ b/test/webkit/dfg-multi-basic-block-structure-clobber.js
@@ -53,4 +53,3 @@
}
shouldBe("foo(predicate, {f:object})", "" + expected);
}
-
diff --git a/test/webkit/dfg-multiply.js b/test/webkit/dfg-multiply.js
index 95f278f..e52c5bd 100644
--- a/test/webkit/dfg-multiply.js
+++ b/test/webkit/dfg-multiply.js
@@ -65,4 +65,3 @@
shouldBe("doMultiplyConstant4(-1073741824)", "-4294967296");
shouldBe("doMultiplyConstant4(-2147483648)", "-8589934592");
}
-
diff --git a/test/webkit/dfg-negative-array-index.js b/test/webkit/dfg-negative-array-index.js
index f23c7fb..8627ea5 100644
--- a/test/webkit/dfg-negative-array-index.js
+++ b/test/webkit/dfg-negative-array-index.js
@@ -34,4 +34,3 @@
foo(array, -1);
shouldBe("array[-1]", "42");
}
-
diff --git a/test/webkit/dfg-patchable-get-by-id-after-watchpoint.js b/test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
index 9866126..f4d0035 100644
--- a/test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
+++ b/test/webkit/dfg-patchable-get-by-id-after-watchpoint.js
@@ -67,4 +67,3 @@
}
shouldBe("foo(o, p)", "" + expected);
}
-
diff --git a/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js b/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js
index f8a6794..cbe4343 100644
--- a/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js
+++ b/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-both-proven-final-object.js
@@ -43,4 +43,3 @@
} else
shouldThrow("foo({f:42}, null)");
}
-
diff --git a/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-proven-final-object.js b/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-proven-final-object.js
index 5e27539..7fbc386 100644
--- a/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-proven-final-object.js
+++ b/test/webkit/dfg-peephole-compare-final-object-to-final-object-or-other-when-proven-final-object.js
@@ -42,4 +42,3 @@
} else
shouldThrow("foo({f:42}, null)");
}
-
diff --git a/test/webkit/dfg-phantom-base.js b/test/webkit/dfg-phantom-base.js
index f881b89..9b32195 100644
--- a/test/webkit/dfg-phantom-base.js
+++ b/test/webkit/dfg-phantom-base.js
@@ -39,4 +39,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("foo(i < 190 ? {f:42, g:{h:3}} : {f:42, g:{}})", "false");
-
diff --git a/test/webkit/dfg-phantom-get-local.js b/test/webkit/dfg-phantom-get-local.js
index d813436..c29dcf6 100644
--- a/test/webkit/dfg-phantom-get-local.js
+++ b/test/webkit/dfg-phantom-get-local.js
@@ -39,4 +39,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("foo(i < 190 ? {f:42, g:{h:3}} : {f:42, g:{}})", "false");
-
diff --git a/test/webkit/dfg-proto-access-inline-osr-exit.js b/test/webkit/dfg-proto-access-inline-osr-exit.js
index 3529980..19cd657 100644
--- a/test/webkit/dfg-proto-access-inline-osr-exit.js
+++ b/test/webkit/dfg-proto-access-inline-osr-exit.js
@@ -41,4 +41,3 @@
myProto.g = 67;
shouldBe("foo({g:new Thingy()})", "42");
}
-
diff --git a/test/webkit/dfg-proven-sqrt-backwards-propagation.js b/test/webkit/dfg-proven-sqrt-backwards-propagation.js
index 5bc66d9..bc2eef1 100644
--- a/test/webkit/dfg-proven-sqrt-backwards-propagation.js
+++ b/test/webkit/dfg-proven-sqrt-backwards-propagation.js
@@ -47,4 +47,3 @@
}
shouldBe("foo(array, 0)", expected);
}
-
diff --git a/test/webkit/dfg-put-by-id-allocate-storage-polymorphic.js b/test/webkit/dfg-put-by-id-allocate-storage-polymorphic.js
index 5a8e2c0..710acb7 100644
--- a/test/webkit/dfg-put-by-id-allocate-storage-polymorphic.js
+++ b/test/webkit/dfg-put-by-id-allocate-storage-polymorphic.js
@@ -54,5 +54,3 @@
else
shouldBe("o.foo", "void 0");
}
-
-
diff --git a/test/webkit/dfg-put-by-id-allocate-storage.js b/test/webkit/dfg-put-by-id-allocate-storage.js
index 4bd9d45..e803f93 100644
--- a/test/webkit/dfg-put-by-id-allocate-storage.js
+++ b/test/webkit/dfg-put-by-id-allocate-storage.js
@@ -47,5 +47,3 @@
shouldBe("o.f", "6");
shouldBe("o.g", "7");
}
-
-
diff --git a/test/webkit/dfg-put-by-id-prototype-check.js b/test/webkit/dfg-put-by-id-prototype-check.js
index a8b6137..035bcb0 100644
--- a/test/webkit/dfg-put-by-id-prototype-check.js
+++ b/test/webkit/dfg-put-by-id-prototype-check.js
@@ -49,4 +49,3 @@
} else
shouldBe("o.f", "" + i);
}
-
diff --git a/test/webkit/dfg-put-by-id-reallocate-storage-polymorphic.js b/test/webkit/dfg-put-by-id-reallocate-storage-polymorphic.js
index c3fe0fd..5498bb4 100644
--- a/test/webkit/dfg-put-by-id-reallocate-storage-polymorphic.js
+++ b/test/webkit/dfg-put-by-id-reallocate-storage-polymorphic.js
@@ -68,5 +68,3 @@
else
shouldBe("o.foo", "void 0");
}
-
-
diff --git a/test/webkit/dfg-put-by-id-reallocate-storage.js b/test/webkit/dfg-put-by-id-reallocate-storage.js
index e6c19ee..50948a2 100644
--- a/test/webkit/dfg-put-by-id-reallocate-storage.js
+++ b/test/webkit/dfg-put-by-id-reallocate-storage.js
@@ -61,5 +61,3 @@
shouldBe("o.m", "13");
shouldBe("o.n", "14");
}
-
-
diff --git a/test/webkit/dfg-put-by-val-setter-then-get-by-val.js b/test/webkit/dfg-put-by-val-setter-then-get-by-val.js
index 40d79e0..930fbe5 100644
--- a/test/webkit/dfg-put-by-val-setter-then-get-by-val.js
+++ b/test/webkit/dfg-put-by-val-setter-then-get-by-val.js
@@ -43,4 +43,3 @@
shouldBe("foo(array, -1, i)", "42");
shouldBe("thingy", "" + i);
}
-
diff --git a/test/webkit/dfg-put-scoped-var-backward-flow.js b/test/webkit/dfg-put-scoped-var-backward-flow.js
index 9f3bfd3..32df63b 100644
--- a/test/webkit/dfg-put-scoped-var-backward-flow.js
+++ b/test/webkit/dfg-put-scoped-var-backward-flow.js
@@ -35,4 +35,3 @@
for (var i = 0; i < 200; ++i)
shouldBe("sum([2147483646, 2147483644])", "4294967290");
-
diff --git a/test/webkit/dfg-sqrt-backwards-propagation.js b/test/webkit/dfg-sqrt-backwards-propagation.js
index 9954e3a..aec4b4b 100644
--- a/test/webkit/dfg-sqrt-backwards-propagation.js
+++ b/test/webkit/dfg-sqrt-backwards-propagation.js
@@ -46,4 +46,3 @@
}
shouldBe("foo(" + f + ", " + array + ", 0)", expected);
}
-
diff --git a/test/webkit/dfg-store-unexpected-value-into-argument-and-osr-exit.js b/test/webkit/dfg-store-unexpected-value-into-argument-and-osr-exit.js
index 1006c28..77a02c3 100644
--- a/test/webkit/dfg-store-unexpected-value-into-argument-and-osr-exit.js
+++ b/test/webkit/dfg-store-unexpected-value-into-argument-and-osr-exit.js
@@ -61,4 +61,3 @@
}
shouldBe("foo(3, {f:f, g:g}, p)", "" + expected);
}
-
diff --git a/test/webkit/dfg-string-stricteq.js b/test/webkit/dfg-string-stricteq.js
index 27a809a..510709a 100644
--- a/test/webkit/dfg-string-stricteq.js
+++ b/test/webkit/dfg-string-stricteq.js
@@ -49,4 +49,3 @@
shouldBe("foo({f:\"" + a + "\"}, {f:\"" + b + "\"})", "[" + (a.length + b.length) + ", " + areEqual + "]");
shouldBe("bar({f:\"" + a + "\"}, {f:\"" + b + "\"})", "" + (areEqual ? a.length + b.length + 1 : a.length + b.length - 1));
}
-
diff --git a/test/webkit/dfg-tear-off-arguments-not-activation.js b/test/webkit/dfg-tear-off-arguments-not-activation.js
index d3967cc..e18a086 100644
--- a/test/webkit/dfg-tear-off-arguments-not-activation.js
+++ b/test/webkit/dfg-tear-off-arguments-not-activation.js
@@ -42,4 +42,3 @@
shouldBe("thingy.length", "1");
shouldBe("thingy[0]", "false");
}
-
diff --git a/test/webkit/dfg-tear-off-function-dot-arguments.js b/test/webkit/dfg-tear-off-function-dot-arguments.js
index a8582bf..cdbf4bd 100644
--- a/test/webkit/dfg-tear-off-function-dot-arguments.js
+++ b/test/webkit/dfg-tear-off-function-dot-arguments.js
@@ -42,4 +42,3 @@
shouldBe("thingy.length", "1");
shouldBe("thingy[0]", "false");
}
-
diff --git a/test/webkit/dfg-to-string-on-cell.js b/test/webkit/dfg-to-string-on-cell.js
index 8ae7388..75af16d 100644
--- a/test/webkit/dfg-to-string-on-cell.js
+++ b/test/webkit/dfg-to-string-on-cell.js
@@ -29,4 +29,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("\"\" + foo(\"foo\", i % 2 ? \"hello\" : [1, 2, 3])", i % 2 ? "\"foo,hello\"" : "\"foo,1,2,3\"");
-
diff --git a/test/webkit/dfg-to-string-on-value.js b/test/webkit/dfg-to-string-on-value.js
index 0c89f3b..a10767b 100644
--- a/test/webkit/dfg-to-string-on-value.js
+++ b/test/webkit/dfg-to-string-on-value.js
@@ -29,4 +29,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("\"\" + foo(\"foo\", i % 2 ? \"hello\" : 42)", i % 2 ? "\"foo,hello\"" : "\"foo,42\"");
-
diff --git a/test/webkit/dfg-to-string-toString-becomes-bad-with-check-structure.js b/test/webkit/dfg-to-string-toString-becomes-bad-with-check-structure.js
index e37fa99..254b5f2 100644
--- a/test/webkit/dfg-to-string-toString-becomes-bad-with-check-structure.js
+++ b/test/webkit/dfg-to-string-toString-becomes-bad-with-check-structure.js
@@ -34,4 +34,3 @@
String.prototype.toString = function() { return 42; }
shouldBe("foo.call(new String(\"foo\"))", i >= 99 ? "\"42\"" : "\"foo\"");
}
-
diff --git a/test/webkit/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype.js b/test/webkit/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype.js
index 6db3467..faee443 100644
--- a/test/webkit/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype.js
+++ b/test/webkit/dfg-to-string-toString-becomes-bad-with-dictionary-string-prototype.js
@@ -46,4 +46,3 @@
}
shouldBe("\"\" + foo(\"hello\")", expected);
}
-
diff --git a/test/webkit/dfg-to-string-toString-becomes-bad.js b/test/webkit/dfg-to-string-toString-becomes-bad.js
index d15917a..433475d 100644
--- a/test/webkit/dfg-to-string-toString-becomes-bad.js
+++ b/test/webkit/dfg-to-string-toString-becomes-bad.js
@@ -39,4 +39,3 @@
}
shouldBe("\"\" + foo(\"hello\")", expected);
}
-
diff --git a/test/webkit/dfg-to-string-toString-in-string.js b/test/webkit/dfg-to-string-toString-in-string.js
index 17f5794..f7f8099 100644
--- a/test/webkit/dfg-to-string-toString-in-string.js
+++ b/test/webkit/dfg-to-string-toString-in-string.js
@@ -41,4 +41,3 @@
}
shouldBe("\"\" + foo(argument)", expected);
}
-
diff --git a/test/webkit/dfg-to-string-valueOf-in-string.js b/test/webkit/dfg-to-string-valueOf-in-string.js
index e591bf7..e5c4c6b 100644
--- a/test/webkit/dfg-to-string-valueOf-in-string.js
+++ b/test/webkit/dfg-to-string-valueOf-in-string.js
@@ -39,4 +39,3 @@
}
shouldBe("\"\" + foo(argument)", "\"hello\"");
}
-
diff --git a/test/webkit/dfg-uint32-to-number-in-middle-of-copy-propagation.js b/test/webkit/dfg-uint32-to-number-in-middle-of-copy-propagation.js
index 7705f03..dc02237 100644
--- a/test/webkit/dfg-uint32-to-number-in-middle-of-copy-propagation.js
+++ b/test/webkit/dfg-uint32-to-number-in-middle-of-copy-propagation.js
@@ -35,4 +35,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("foo(-1)", "[-1, 4294967295]");
-
diff --git a/test/webkit/dfg-uint32-to-number-on-captured-variable.js b/test/webkit/dfg-uint32-to-number-on-captured-variable.js
index ec2be1d..1236554 100644
--- a/test/webkit/dfg-uint32-to-number-on-captured-variable.js
+++ b/test/webkit/dfg-uint32-to-number-on-captured-variable.js
@@ -34,4 +34,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("foo(" + i + ")()", "" + i);
-
diff --git a/test/webkit/dfg-uint32-to-number-skip-then-exit.js b/test/webkit/dfg-uint32-to-number-skip-then-exit.js
index 13029d2..40d3a13 100644
--- a/test/webkit/dfg-uint32-to-number-skip-then-exit.js
+++ b/test/webkit/dfg-uint32-to-number-skip-then-exit.js
@@ -42,4 +42,3 @@
}
shouldBe("foo(i, 1, o)", "" + expected);
}
-
diff --git a/test/webkit/dfg-uint32-to-number.js b/test/webkit/dfg-uint32-to-number.js
index f7c11d1..7fc98da 100644
--- a/test/webkit/dfg-uint32-to-number.js
+++ b/test/webkit/dfg-uint32-to-number.js
@@ -39,4 +39,3 @@
shouldBe("foo({f:2147483648}, {f:32})", "2147483648");
shouldBe("foo({f:2147483648}, {f:31})", "1");
shouldBe("foo({f:2147483648}, {f:30})", "2");
-
diff --git a/test/webkit/dfg-uint32array-overflow-constant.js b/test/webkit/dfg-uint32array-overflow-constant.js
index 1de13a3..6d7f06a 100644
--- a/test/webkit/dfg-uint32array-overflow-constant.js
+++ b/test/webkit/dfg-uint32array-overflow-constant.js
@@ -35,4 +35,3 @@
foo(array);
shouldBe("array[0]", "0x8005465c");
}
-
diff --git a/test/webkit/dfg-weak-js-constant-silent-fill.js b/test/webkit/dfg-weak-js-constant-silent-fill.js
index fa06a90..84f3f4b 100644
--- a/test/webkit/dfg-weak-js-constant-silent-fill.js
+++ b/test/webkit/dfg-weak-js-constant-silent-fill.js
@@ -45,4 +45,3 @@
shouldBe("o2.f", "false");
shouldBe("o3.f", "false");
}
-
diff --git a/test/webkit/fast/js/JSON-parse-reviver.js b/test/webkit/fast/js/JSON-parse-reviver.js
index b02a2fc..1f04602 100644
--- a/test/webkit/fast/js/JSON-parse-reviver.js
+++ b/test/webkit/fast/js/JSON-parse-reviver.js
@@ -201,5 +201,3 @@
}
shouldBe('JSON.stringify(JSON.parse("[0,1]", reviveIntroducesNewArrayLikeObject))', '\'[0,["a","a"]]\'');
-
-
diff --git a/test/webkit/fast/js/deep-recursion-test.js b/test/webkit/fast/js/deep-recursion-test.js
index 59df2f1..c2a695d 100644
--- a/test/webkit/fast/js/deep-recursion-test.js
+++ b/test/webkit/fast/js/deep-recursion-test.js
@@ -75,4 +75,4 @@
} catch (ex) {
var msg = String(eval(ex));
shouldBe("msg", "'RangeError: Maximum call stack size exceeded.'");
- }
\ No newline at end of file
+ }
diff --git a/test/webkit/fast/js/function-decompilation-operators.js b/test/webkit/fast/js/function-decompilation-operators.js
index 759767f..cab6dfa 100644
--- a/test/webkit/fast/js/function-decompilation-operators.js
+++ b/test/webkit/fast/js/function-decompilation-operators.js
@@ -80,4 +80,4 @@
for (test in tests) {
var decompiledFunction = eval("(function () { " + tests[test] + ";})").toString().replace(/\n/g, "");
shouldBe("decompiledFunction", "'function () { " + tests[test] + ";}'");
- }
\ No newline at end of file
+ }
diff --git a/test/webkit/fast/js/kde/Array.js b/test/webkit/fast/js/kde/Array.js
index 26bf331..595c3b3 100644
--- a/test/webkit/fast/js/kde/Array.js
+++ b/test/webkit/fast/js/kde/Array.js
@@ -233,4 +233,4 @@
Number.prototype.toLocaleString = backupNumberToLocaleString;
RegExp.prototype.toString = backupRegExpToString;
RegExp.prototype.toLocaleString = backupRegExpToLocaleString;
-}
\ No newline at end of file
+}
diff --git a/test/webkit/fast/js/kde/Boolean.js b/test/webkit/fast/js/kde/Boolean.js
index dbc117a..6ddb953 100644
--- a/test/webkit/fast/js/kde/Boolean.js
+++ b/test/webkit/fast/js/kde/Boolean.js
@@ -29,4 +29,4 @@
shouldBe("(new Boolean(false)).valueOf()", "false");
shouldBe("(new Boolean(Boolean(true))).valueOf()", "true");
shouldBeTrue("true.valueOf() === true");
-shouldBeTrue("false.toString() === 'false'");
\ No newline at end of file
+shouldBeTrue("false.toString() === 'false'");
diff --git a/test/webkit/fast/js/kde/Date-setYear.js b/test/webkit/fast/js/kde/Date-setYear.js
index 4ccf025..140403d 100644
--- a/test/webkit/fast/js/kde/Date-setYear.js
+++ b/test/webkit/fast/js/kde/Date-setYear.js
@@ -33,4 +33,4 @@
shouldBe("d.setYear(2050), d.getFullYear()", "2050");
shouldBe("d.setYear(1899), d.getFullYear()", "1899");
shouldBe("d.setYear(2000), d.getFullYear()", "2000");
-shouldBe("d.setYear(2100), d.getFullYear()", "2100");
\ No newline at end of file
+shouldBe("d.setYear(2100), d.getFullYear()", "2100");
diff --git a/test/webkit/fast/js/kde/Error.js b/test/webkit/fast/js/kde/Error.js
index 6ecd5c3..0f1d911 100644
--- a/test/webkit/fast/js/kde/Error.js
+++ b/test/webkit/fast/js/kde/Error.js
@@ -32,4 +32,4 @@
shouldBe("Object.prototype.toString.apply(Error())", "'[object Error]'");
shouldBe("Object.prototype.toString.apply(Error)", "'[object Function]'");
-shouldBe("Object.prototype.toString.apply(EvalError)", "'[object Function]'");
\ No newline at end of file
+shouldBe("Object.prototype.toString.apply(EvalError)", "'[object Function]'");
diff --git a/test/webkit/fast/js/kde/GlobalObject.js b/test/webkit/fast/js/kde/GlobalObject.js
index 112aea8..aa09cd2 100644
--- a/test/webkit/fast/js/kde/GlobalObject.js
+++ b/test/webkit/fast/js/kde/GlobalObject.js
@@ -96,4 +96,4 @@
shouldBeFalse("isFinite(parseFloat('Infinity'))");
shouldBeFalse("delete NaN");
shouldBeFalse("delete Infinity");
-shouldBeFalse("delete undefined");
\ No newline at end of file
+shouldBeFalse("delete undefined");
diff --git a/test/webkit/fast/js/kde/Number.js b/test/webkit/fast/js/kde/Number.js
index 358fe7a..946c093 100644
--- a/test/webkit/fast/js/kde/Number.js
+++ b/test/webkit/fast/js/kde/Number.js
@@ -496,4 +496,4 @@
shouldBe("Number(0).toPrecision(18)","\"0.00000000000000000\"");
shouldBe("Number(0).toPrecision(19)","\"0.000000000000000000\"");
shouldBe("Number(0).toPrecision(20)","\"0.0000000000000000000\"");
-shouldBe("Number(0).toPrecision(21)","\"0.00000000000000000000\"");
\ No newline at end of file
+shouldBe("Number(0).toPrecision(21)","\"0.00000000000000000000\"");
diff --git a/test/webkit/fast/js/kde/Object.js b/test/webkit/fast/js/kde/Object.js
index 2637309..5138128 100644
--- a/test/webkit/fast/js/kde/Object.js
+++ b/test/webkit/fast/js/kde/Object.js
@@ -39,4 +39,4 @@
shouldBe("String(Object())", "'[object Object]'");
shouldBe("Object().toString()", "'[object Object]'");
-shouldBe("String(Object().valueOf())", "'[object Object]'");
\ No newline at end of file
+shouldBe("String(Object().valueOf())", "'[object Object]'");
diff --git a/test/webkit/fast/js/kde/Prototype.js b/test/webkit/fast/js/kde/Prototype.js
index a2971fd..8e6638e 100644
--- a/test/webkit/fast/js/kde/Prototype.js
+++ b/test/webkit/fast/js/kde/Prototype.js
@@ -55,4 +55,4 @@
///////////////////////////////////////////////////////
-shouldBe("delete Boolean.prototype", "false");
\ No newline at end of file
+shouldBe("delete Boolean.prototype", "false");
diff --git a/test/webkit/fast/js/kde/RegExp.js b/test/webkit/fast/js/kde/RegExp.js
index eea6a87..ede84d0 100644
--- a/test/webkit/fast/js/kde/RegExp.js
+++ b/test/webkit/fast/js/kde/RegExp.js
@@ -179,4 +179,4 @@
shouldBe("/(?:)/.toString()", "'/(?:)/'");
shouldBe("/(?:)/.source", "'(?:)'");
-debug("Done.");
\ No newline at end of file
+debug("Done.");
diff --git a/test/webkit/fast/js/kde/arguments-scope.js b/test/webkit/fast/js/kde/arguments-scope.js
index cef3698..b697739 100644
--- a/test/webkit/fast/js/kde/arguments-scope.js
+++ b/test/webkit/fast/js/kde/arguments-scope.js
@@ -70,4 +70,4 @@
test1();
test2(42);
test3();
-test4();
\ No newline at end of file
+test4();
diff --git a/test/webkit/fast/js/kde/assignments.js b/test/webkit/fast/js/kde/assignments.js
index 2cb49cf..d654bb3 100644
--- a/test/webkit/fast/js/kde/assignments.js
+++ b/test/webkit/fast/js/kde/assignments.js
@@ -33,4 +33,4 @@
shouldBe("var i = 1; i >>= 2", "0");
shouldBe("var i = -8; i >>= 24", "-1");
shouldBe("var i = 8; i >>>= 2", "2");
-shouldBe("var i = -8; i >>>= 24", "255");
\ No newline at end of file
+shouldBe("var i = -8; i >>>= 24", "255");
diff --git a/test/webkit/fast/js/kde/cast.js b/test/webkit/fast/js/kde/cast.js
index c8d3792..72d5e1c 100644
--- a/test/webkit/fast/js/kde/cast.js
+++ b/test/webkit/fast/js/kde/cast.js
@@ -25,4 +25,4 @@
shouldBeTrue("Boolean(1) === true");
shouldBeTrue("var s = String; s(1) === '1'");
shouldBeTrue("n = Number; n(true) === 1");
-shouldBe("String(Array('a', 'b' ))", "'a,b'");
\ No newline at end of file
+shouldBe("String(Array('a', 'b' ))", "'a,b'");
diff --git a/test/webkit/fast/js/kde/comment-1.js b/test/webkit/fast/js/kde/comment-1.js
index 043f052..391ab8e 100644
--- a/test/webkit/fast/js/kde/comment-1.js
+++ b/test/webkit/fast/js/kde/comment-1.js
@@ -22,4 +22,4 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
-// comment with linebreak
\ No newline at end of file
+// comment with linebreak
diff --git a/test/webkit/fast/js/kde/comment-2.js b/test/webkit/fast/js/kde/comment-2.js
index 043f052..391ab8e 100644
--- a/test/webkit/fast/js/kde/comment-2.js
+++ b/test/webkit/fast/js/kde/comment-2.js
@@ -22,4 +22,4 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
-// comment with linebreak
\ No newline at end of file
+// comment with linebreak
diff --git a/test/webkit/fast/js/kde/completion.js b/test/webkit/fast/js/kde/completion.js
index f75c98f..f9f0209 100644
--- a/test/webkit/fast/js/kde/completion.js
+++ b/test/webkit/fast/js/kde/completion.js
@@ -46,4 +46,4 @@
val = eval("14; function f() {}");
shouldBe("val", "14");
val = eval("15; var v = 0");
-shouldBe("val", "15");
\ No newline at end of file
+shouldBe("val", "15");
diff --git a/test/webkit/fast/js/kde/conditional.js b/test/webkit/fast/js/kde/conditional.js
index ee9c0bf..beed207 100644
--- a/test/webkit/fast/js/kde/conditional.js
+++ b/test/webkit/fast/js/kde/conditional.js
@@ -30,4 +30,4 @@
var a = 1;
if ( undefined )
a = 2;
-shouldBe("/*var a=1;if (undefined) a = 2;*/ a", "1");
\ No newline at end of file
+shouldBe("/*var a=1;if (undefined) a = 2;*/ a", "1");
diff --git a/test/webkit/fast/js/kde/constructor_length.js b/test/webkit/fast/js/kde/constructor_length.js
index 5ec9dda..75ddd50 100644
--- a/test/webkit/fast/js/kde/constructor_length.js
+++ b/test/webkit/fast/js/kde/constructor_length.js
@@ -36,4 +36,4 @@
shouldBe("ReferenceError.length","1");
shouldBe("SyntaxError.length","1");
shouldBe("TypeError.length","1");
-shouldBe("URIError.length","1");
\ No newline at end of file
+shouldBe("URIError.length","1");
diff --git a/test/webkit/fast/js/kde/crash-1.js b/test/webkit/fast/js/kde/crash-1.js
index 316ce51..e0b082e 100644
--- a/test/webkit/fast/js/kde/crash-1.js
+++ b/test/webkit/fast/js/kde/crash-1.js
@@ -29,4 +29,4 @@
v.toString();
} catch (e) {
debug("OK. Caught an exception.");
-}
\ No newline at end of file
+}
diff --git a/test/webkit/fast/js/kde/crash-2.js b/test/webkit/fast/js/kde/crash-2.js
index 84bd67f..feab15b 100644
--- a/test/webkit/fast/js/kde/crash-2.js
+++ b/test/webkit/fast/js/kde/crash-2.js
@@ -31,4 +31,4 @@
foo();
} catch (e) {
debug("OK. Caught an exception");
-}
\ No newline at end of file
+}
diff --git a/test/webkit/fast/js/kde/delete.js b/test/webkit/fast/js/kde/delete.js
index 0acb308..8aeb0d0 100644
--- a/test/webkit/fast/js/kde/delete.js
+++ b/test/webkit/fast/js/kde/delete.js
@@ -24,4 +24,4 @@
description("KDE JS Test");
shouldBe("a = 1; delete a;", "true");
shouldBe("delete nonexistant;", "true");
-shouldBe("delete NaN", "false");
\ No newline at end of file
+shouldBe("delete NaN", "false");
diff --git a/test/webkit/fast/js/kde/empty.js b/test/webkit/fast/js/kde/empty.js
index f09008a..6ab1596 100644
--- a/test/webkit/fast/js/kde/empty.js
+++ b/test/webkit/fast/js/kde/empty.js
@@ -21,4 +21,4 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-description("KDE JS Test");
\ No newline at end of file
+description("KDE JS Test");
diff --git a/test/webkit/fast/js/kde/encode_decode_uri.js b/test/webkit/fast/js/kde/encode_decode_uri.js
index c58cc12..54f374e 100644
--- a/test/webkit/fast/js/kde/encode_decode_uri.js
+++ b/test/webkit/fast/js/kde/encode_decode_uri.js
@@ -99,4 +99,4 @@
}
checkWithFunctions("encodeURI", "decodeURI");
-checkWithFunctions("encodeURIComponent", "decodeURIComponent");
\ No newline at end of file
+checkWithFunctions("encodeURIComponent", "decodeURIComponent");
diff --git a/test/webkit/fast/js/kde/eval.js b/test/webkit/fast/js/kde/eval.js
index 7c4b5d4..03d05e4 100644
--- a/test/webkit/fast/js/kde/eval.js
+++ b/test/webkit/fast/js/kde/eval.js
@@ -53,4 +53,4 @@
for (var j = 0; j < 1; j++)
return eval('j');
}
-shouldBe("lotto()", "0");
\ No newline at end of file
+shouldBe("lotto()", "0");
diff --git a/test/webkit/fast/js/kde/evil-n.js b/test/webkit/fast/js/kde/evil-n.js
index b9b5cdb..71c9dc5 100644
--- a/test/webkit/fast/js/kde/evil-n.js
+++ b/test/webkit/fast/js/kde/evil-n.js
@@ -25,4 +25,4 @@
shouldBe("(new Error()).message", "''");
// the empty match isn't taken in account
-shouldBe("''.split(/.*/).length", "0");
\ No newline at end of file
+shouldBe("''.split(/.*/).length", "0");
diff --git a/test/webkit/fast/js/kde/exception_propagation.js b/test/webkit/fast/js/kde/exception_propagation.js
index 71be4f7..9d6e753 100644
--- a/test/webkit/fast/js/kde/exception_propagation.js
+++ b/test/webkit/fast/js/kde/exception_propagation.js
@@ -443,4 +443,4 @@
catch (e) {
}
shouldBe("set_inside_with_cantconverttoobject","4");
-// ### test case, sw
\ No newline at end of file
+// ### test case, sw
diff --git a/test/webkit/fast/js/kde/exceptions.js b/test/webkit/fast/js/kde/exceptions.js
index f2c9872..73b7b57 100644
--- a/test/webkit/fast/js/kde/exceptions.js
+++ b/test/webkit/fast/js/kde/exceptions.js
@@ -124,4 +124,4 @@
testReferenceError();
testFunctionError();
testMathFunctionError();
-testWhileAbortion();
\ No newline at end of file
+testWhileAbortion();
diff --git a/test/webkit/fast/js/kde/func-decl.js b/test/webkit/fast/js/kde/func-decl.js
index b046b22..672aeca 100644
--- a/test/webkit/fast/js/kde/func-decl.js
+++ b/test/webkit/fast/js/kde/func-decl.js
@@ -65,4 +65,4 @@
}
}
-test();
\ No newline at end of file
+test();
diff --git a/test/webkit/fast/js/kde/inbuilt_function_proto.js b/test/webkit/fast/js/kde/inbuilt_function_proto.js
index de13b70..294e23a 100644
--- a/test/webkit/fast/js/kde/inbuilt_function_proto.js
+++ b/test/webkit/fast/js/kde/inbuilt_function_proto.js
@@ -114,4 +114,4 @@
shouldBe("RegExp.prototype.exec.__proto__","Function.prototype");
shouldBe("RegExp.prototype.test.__proto__","Function.prototype");
shouldBe("RegExp.prototype.toString.__proto__","Function.prototype");
-shouldBe("Error.prototype.toString.__proto__","Function.prototype");
\ No newline at end of file
+shouldBe("Error.prototype.toString.__proto__","Function.prototype");
diff --git a/test/webkit/fast/js/kde/iteration.js b/test/webkit/fast/js/kde/iteration.js
index 7004be0..3f76cc1 100644
--- a/test/webkit/fast/js/kde/iteration.js
+++ b/test/webkit/fast/js/kde/iteration.js
@@ -76,4 +76,4 @@
for (var a = [1,2,3], length = a.length, i = 0; i < length; i++) {
list += a[i];
}
-shouldBe("list", "'123'");
\ No newline at end of file
+shouldBe("list", "'123'");
diff --git a/test/webkit/fast/js/kde/j-comment-3.js b/test/webkit/fast/js/kde/j-comment-3.js
index 2cf0a0f..e20d83a 100644
--- a/test/webkit/fast/js/kde/j-comment-3.js
+++ b/test/webkit/fast/js/kde/j-comment-3.js
@@ -22,4 +22,4 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
-<!-- HTML comment (not ECMA)
\ No newline at end of file
+<!-- HTML comment (not ECMA)
diff --git a/test/webkit/fast/js/kde/j-comment-4.js b/test/webkit/fast/js/kde/j-comment-4.js
index 4d23f3b..314493f 100644
--- a/test/webkit/fast/js/kde/j-comment-4.js
+++ b/test/webkit/fast/js/kde/j-comment-4.js
@@ -22,4 +22,4 @@
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
description("KDE JS Test");
---> end of HTML comment (not ECMA)
\ No newline at end of file
+--> end of HTML comment (not ECMA)
diff --git a/test/webkit/fast/js/kde/literals.js b/test/webkit/fast/js/kde/literals.js
index 57cf8cd..ca6f054 100644
--- a/test/webkit/fast/js/kde/literals.js
+++ b/test/webkit/fast/js/kde/literals.js
@@ -35,4 +35,4 @@
shouldBe("01", "1");
shouldBe("010", "8");
shouldBe("09", "9");
-shouldBe("019", "19");
\ No newline at end of file
+shouldBe("019", "19");
diff --git a/test/webkit/fast/js/kde/lval-exceptions.js b/test/webkit/fast/js/kde/lval-exceptions.js
index 32641f8..14012b5 100644
--- a/test/webkit/fast/js/kde/lval-exceptions.js
+++ b/test/webkit/fast/js/kde/lval-exceptions.js
@@ -71,4 +71,4 @@
} catch (e) {
testFailed(f + " threw an exception " + e + " when no exception expected");
}
-}
\ No newline at end of file
+}
diff --git a/test/webkit/fast/js/kde/math.js b/test/webkit/fast/js/kde/math.js
index 3cbb1b2..4f73809 100644
--- a/test/webkit/fast/js/kde/math.js
+++ b/test/webkit/fast/js/kde/math.js
@@ -128,4 +128,4 @@
Math.myprop=true; // adding a custom property to the math object (why not?)
list=""
for ( var i in Math ) { list += i + ','; }
-shouldBe("list","'myprop,'");
\ No newline at end of file
+shouldBe("list","'myprop,'");
diff --git a/test/webkit/fast/js/kde/md5-1.js b/test/webkit/fast/js/kde/md5-1.js
index 9c20c55..5df7af0 100644
--- a/test/webkit/fast/js/kde/md5-1.js
+++ b/test/webkit/fast/js/kde/md5-1.js
@@ -410,4 +410,4 @@
return s;
}
-shouldBe("MD5('kde')", "'186cf28b76f2264e9fea8fcf91cb4f5d'");
\ No newline at end of file
+shouldBe("MD5('kde')", "'186cf28b76f2264e9fea8fcf91cb4f5d'");
diff --git a/test/webkit/fast/js/kde/md5-2.js b/test/webkit/fast/js/kde/md5-2.js
index fa59170..1b9d4aa 100644
--- a/test/webkit/fast/js/kde/md5-2.js
+++ b/test/webkit/fast/js/kde/md5-2.js
@@ -240,4 +240,4 @@
function b64MD5 (str) { return binl2b64(coreMD5( str2binl(str))) }
function b64MD5w(str) { return binl2b64(coreMD5(strw2binl(str))) }
/* Backward compatibility */
-function calcMD5(str) { return binl2hex(coreMD5( str2binl(str))) }
\ No newline at end of file
+function calcMD5(str) { return binl2hex(coreMD5( str2binl(str))) }
diff --git a/test/webkit/fast/js/kde/object_prototype.js b/test/webkit/fast/js/kde/object_prototype.js
index 3b17cf6..8ffaf14 100644
--- a/test/webkit/fast/js/kde/object_prototype.js
+++ b/test/webkit/fast/js/kde/object_prototype.js
@@ -98,4 +98,4 @@
shouldBe("myfunc.propertyIsEnumerable('length')","false");
shouldBe("myfunc.propertyIsEnumerable('someproperty')","true");
shouldBe("checkEnumerable(myfunc,'length')","false");
-shouldBe("checkEnumerable(myfunc,'someproperty')","true");
\ No newline at end of file
+shouldBe("checkEnumerable(myfunc,'someproperty')","true");
diff --git a/test/webkit/fast/js/kde/object_prototype_tostring.js b/test/webkit/fast/js/kde/object_prototype_tostring.js
index 9814d8c..8b3ce98 100644
--- a/test/webkit/fast/js/kde/object_prototype_tostring.js
+++ b/test/webkit/fast/js/kde/object_prototype_tostring.js
@@ -48,4 +48,4 @@
shouldBe("_error.toString()","\"[object Error]\"");
var _function = new Function();
_function.toString = Object.prototype.toString;
-shouldBe("_function.toString()","\"[object Function]\"");
\ No newline at end of file
+shouldBe("_function.toString()","\"[object Function]\"");
diff --git a/test/webkit/fast/js/kde/operators.js b/test/webkit/fast/js/kde/operators.js
index 185ae01..38e658b 100644
--- a/test/webkit/fast/js/kde/operators.js
+++ b/test/webkit/fast/js/kde/operators.js
@@ -501,4 +501,4 @@
// instanceof
// Those 2 lines don't parse in Netscape...
shouldBe("(new Boolean()) instanceof Boolean", "true");
-shouldBe("(new Boolean()) instanceof Number", "false");
\ No newline at end of file
+shouldBe("(new Boolean()) instanceof Number", "false");
diff --git a/test/webkit/fast/js/kde/parse.js b/test/webkit/fast/js/kde/parse.js
index ca85e76..94467f1 100644
--- a/test/webkit/fast/js/kde/parse.js
+++ b/test/webkit/fast/js/kde/parse.js
@@ -63,4 +63,4 @@
shouldThrow("var \\u0030;");
shouldThrow("var test = { }; test.i= 0; test.i\\u002b= 1; test.i;");
-shouldBe("var test = { }; test.i= 0; test.i\u002b= 1; test.i;", "1");
\ No newline at end of file
+shouldBe("var test = { }; test.i= 0; test.i\u002b= 1; test.i;", "1");
diff --git a/test/webkit/fast/js/kde/prototype_length.js b/test/webkit/fast/js/kde/prototype_length.js
index 2936fa5..4eb888c 100644
--- a/test/webkit/fast/js/kde/prototype_length.js
+++ b/test/webkit/fast/js/kde/prototype_length.js
@@ -57,4 +57,4 @@
var foundStringPrototypeLength = false;
for (i in String.prototype) { if (i == "length") foundStringPrototypeLength = true; }
-shouldBe("foundStringPrototypeLength","false");
\ No newline at end of file
+shouldBe("foundStringPrototypeLength","false");
diff --git a/test/webkit/fast/js/kde/prototype_proto.js b/test/webkit/fast/js/kde/prototype_proto.js
index f956d94..386d503 100644
--- a/test/webkit/fast/js/kde/prototype_proto.js
+++ b/test/webkit/fast/js/kde/prototype_proto.js
@@ -30,4 +30,4 @@
shouldBe("Number.prototype.__proto__","Object.prototype");
shouldBe("Date.prototype.__proto__","Object.prototype");
shouldBe("RegExp.prototype.__proto__","Object.prototype");
-shouldBe("Error.prototype.__proto__","Object.prototype");
\ No newline at end of file
+shouldBe("Error.prototype.__proto__","Object.prototype");
diff --git a/test/webkit/fast/js/kde/scope.js b/test/webkit/fast/js/kde/scope.js
index cead049..e628d47 100644
--- a/test/webkit/fast/js/kde/scope.js
+++ b/test/webkit/fast/js/kde/scope.js
@@ -55,4 +55,4 @@
}
testForIn();
-shouldBe("g", "'foo'"); //Before the eval, g was in outer scope, but not after!
\ No newline at end of file
+shouldBe("g", "'foo'"); //Before the eval, g was in outer scope, but not after!
diff --git a/test/webkit/fast/js/kde/statements.js b/test/webkit/fast/js/kde/statements.js
index ecc6c32..cf8b2a9 100644
--- a/test/webkit/fast/js/kde/statements.js
+++ b/test/webkit/fast/js/kde/statements.js
@@ -96,4 +96,4 @@
return result;
};
-shouldBe("testSwitch4(0)", "'ab'");
\ No newline at end of file
+shouldBe("testSwitch4(0)", "'ab'");
diff --git a/test/webkit/fast/js/kde/var_decl_init.js b/test/webkit/fast/js/kde/var_decl_init.js
index 0bf4a9e..c72ca4e 100644
--- a/test/webkit/fast/js/kde/var_decl_init.js
+++ b/test/webkit/fast/js/kde/var_decl_init.js
@@ -181,4 +181,4 @@
var overrideVar2 = 1;
var overrideVar2 = 2;
-shouldBe("overrideVar2", "2");
\ No newline at end of file
+shouldBe("overrideVar2", "2");
diff --git a/test/webkit/fast/js/string-anchor.js b/test/webkit/fast/js/string-anchor.js
index f213b89..d954928 100644
--- a/test/webkit/fast/js/string-anchor.js
+++ b/test/webkit/fast/js/string-anchor.js
@@ -50,4 +50,4 @@
shouldThrow("String.prototype.anchor.call(null)", '"TypeError: Type error"');
// Check anchor.length.
-shouldBe("String.prototype.anchor.length", "1");
\ No newline at end of file
+shouldBe("String.prototype.anchor.length", "1");
diff --git a/test/webkit/fast/js/string-fontcolor.js b/test/webkit/fast/js/string-fontcolor.js
index 67f4ef2..17ca62f 100644
--- a/test/webkit/fast/js/string-fontcolor.js
+++ b/test/webkit/fast/js/string-fontcolor.js
@@ -50,4 +50,4 @@
shouldThrow("String.prototype.fontcolor.call(null)", '"TypeError: Type error"');
// Check fontcolor.length.
-shouldBe("String.prototype.fontcolor.length", "1");
\ No newline at end of file
+shouldBe("String.prototype.fontcolor.length", "1");
diff --git a/test/webkit/fast/js/string-fontsize.js b/test/webkit/fast/js/string-fontsize.js
index e103e5e..b3b48c5 100644
--- a/test/webkit/fast/js/string-fontsize.js
+++ b/test/webkit/fast/js/string-fontsize.js
@@ -53,4 +53,4 @@
shouldThrow("String.prototype.fontsize.call(null)", '"TypeError: Type error"');
// Check fontsize.length.
-shouldBe("String.prototype.fontsize.length", "1");
\ No newline at end of file
+shouldBe("String.prototype.fontsize.length", "1");
diff --git a/test/webkit/fast/js/string-link.js b/test/webkit/fast/js/string-link.js
index 8b96915..873e7af 100644
--- a/test/webkit/fast/js/string-link.js
+++ b/test/webkit/fast/js/string-link.js
@@ -53,4 +53,4 @@
shouldThrow("String.prototype.link.call(null)", '"TypeError: Type error"');
// Check link.length.
-shouldBe("String.prototype.link.length", "1");
\ No newline at end of file
+shouldBe("String.prototype.link.length", "1");
diff --git a/test/webkit/fast/js/toString-number.js b/test/webkit/fast/js/toString-number.js
index 2acb3d1..6280f41 100644
--- a/test/webkit/fast/js/toString-number.js
+++ b/test/webkit/fast/js/toString-number.js
@@ -91,4 +91,4 @@
shouldBeEqualToString('Number.prototype.toString.call(' + number + ', 36)', stringBase36);
shouldBeEqualToString('Number.prototype.toString.call(new Number(' + number + '), 36)', stringBase36);
}
- successfullyParsed = true;
\ No newline at end of file
+ successfullyParsed = true;
diff --git a/test/webkit/fast/regex/assertion.js b/test/webkit/fast/regex/assertion.js
index 3d980ce..d4c46f2 100644
--- a/test/webkit/fast/regex/assertion.js
+++ b/test/webkit/fast/regex/assertion.js
@@ -107,4 +107,3 @@
var regex24 = /(?=a|b?)c/;
shouldBe("regex24.exec('x')", "null");
-
diff --git a/test/webkit/fast/regex/constructor.js b/test/webkit/fast/regex/constructor.js
index 9d35245..552d82e 100644
--- a/test/webkit/fast/regex/constructor.js
+++ b/test/webkit/fast/regex/constructor.js
@@ -29,4 +29,3 @@
shouldBeTrue("re !== new RegExp(re)");
shouldThrow("re === RegExp(re,'i')");
shouldThrow("re !== new RegExp(re,'i')");
-
diff --git a/test/webkit/fast/regex/dotstar.js b/test/webkit/fast/regex/dotstar.js
index 2069637..883c4aa 100644
--- a/test/webkit/fast/regex/dotstar.js
+++ b/test/webkit/fast/regex/dotstar.js
@@ -157,4 +157,3 @@
var regexp13 = /.*\n\d+.*/;
shouldBe("regexp13.exec('abc\\n123')", "['abc\\n123']");
-
diff --git a/test/webkit/fast/regex/parentheses.js b/test/webkit/fast/regex/parentheses.js
index 57a2830..4d7a141 100644
--- a/test/webkit/fast/regex/parentheses.js
+++ b/test/webkit/fast/regex/parentheses.js
@@ -274,4 +274,3 @@
shouldBe("regexp58.exec('badbc')", "['a']");
var regexp59 = /(X(?:.(?!X))*?Y)|(Y(?:.(?!Y))*?Z)/g;
shouldBe("'Y aaa X Match1 Y aaa Y Match2 Z'.match(regexp59)", "['X Match1 Y','Y Match2 Z']");
-
diff --git a/test/webkit/function-dot-apply-replace-base.js b/test/webkit/function-dot-apply-replace-base.js
index ed0f84b..e0494e5 100644
--- a/test/webkit/function-dot-apply-replace-base.js
+++ b/test/webkit/function-dot-apply-replace-base.js
@@ -44,6 +44,3 @@
}
shouldBe("bar()", "3");
-
-
-
diff --git a/test/webkit/get-by-pname-non-final-object.js b/test/webkit/get-by-pname-non-final-object.js
index f891af6..1c798d1 100644
--- a/test/webkit/get-by-pname-non-final-object.js
+++ b/test/webkit/get-by-pname-non-final-object.js
@@ -70,4 +70,3 @@
shouldBe("foo(r)", "113");
shouldBe("foo(s)", "182");
}
-
diff --git a/test/webkit/get-by-pname-that-looks-like-a-patchable-get-by-val.js b/test/webkit/get-by-pname-that-looks-like-a-patchable-get-by-val.js
index d3e69b6..a0b6ccf 100644
--- a/test/webkit/get-by-pname-that-looks-like-a-patchable-get-by-val.js
+++ b/test/webkit/get-by-pname-that-looks-like-a-patchable-get-by-val.js
@@ -40,5 +40,3 @@
}
shouldBe("foo()", "300");
-
-
diff --git a/test/webkit/get-by-pname.js b/test/webkit/get-by-pname.js
index 13a7c5d..07afa16 100644
--- a/test/webkit/get-by-pname.js
+++ b/test/webkit/get-by-pname.js
@@ -45,4 +45,3 @@
shouldBe("foo(r)", "113");
shouldBe("foo(s)", "182");
}
-
diff --git a/test/webkit/indexed-setter-on-global-object.js b/test/webkit/indexed-setter-on-global-object.js
index 8453206..20c70c2 100644
--- a/test/webkit/indexed-setter-on-global-object.js
+++ b/test/webkit/indexed-setter-on-global-object.js
@@ -34,4 +34,3 @@
this[42] = "foo";
shouldBe("thingy", "\"foo\"");
-
diff --git a/test/webkit/new-array-double-with-holes.js b/test/webkit/new-array-double-with-holes.js
index 208fc91..faf2bfb 100644
--- a/test/webkit/new-array-double-with-holes.js
+++ b/test/webkit/new-array-double-with-holes.js
@@ -31,4 +31,3 @@
for (var i = 0; i < 100; ++i)
shouldBe("foo([, 1.5], 0)", "void 0");
-
diff --git a/test/webkit/regexp-in-and-foreach-handling.js b/test/webkit/regexp-in-and-foreach-handling.js
index a2430db..f345c8f 100644
--- a/test/webkit/regexp-in-and-foreach-handling.js
+++ b/test/webkit/regexp-in-and-foreach-handling.js
@@ -69,4 +69,3 @@
shouldBe('testInOperator(' + i + ')', tests[i][2]);
shouldBe('testForEachFunction(' + i + ')', tests[i][2]);
}
-
diff --git a/test/webkit/regexp-zero-length-alternatives.js b/test/webkit/regexp-zero-length-alternatives.js
index 6e18de0..c91f1c1 100644
--- a/test/webkit/regexp-zero-length-alternatives.js
+++ b/test/webkit/regexp-zero-length-alternatives.js
@@ -272,4 +272,3 @@
shouldBe('s1.match(re34)', '[""]');
shouldBe('s2.match(re34)', '[""]');
shouldBe('s3.match(re34)', '[""]');
-
diff --git a/test/webkit/resolve-arguments-from-scope.js b/test/webkit/resolve-arguments-from-scope.js
index def7158..b3900e7 100644
--- a/test/webkit/resolve-arguments-from-scope.js
+++ b/test/webkit/resolve-arguments-from-scope.js
@@ -42,4 +42,3 @@
shouldBe("foo(42).length", "1");
shouldBe("foo(42, 23)[1]", "23");
}
-
diff --git a/test/webkit/sort-with-side-effecting-comparisons.js b/test/webkit/sort-with-side-effecting-comparisons.js
index 5dda02f..6794e32 100644
--- a/test/webkit/sort-with-side-effecting-comparisons.js
+++ b/test/webkit/sort-with-side-effecting-comparisons.js
@@ -40,5 +40,3 @@
});
testPassed("It worked.");
-
-
diff --git a/test/webkit/stack-unwinding.js b/test/webkit/stack-unwinding.js
index 8c737fa..0a89827 100644
--- a/test/webkit/stack-unwinding.js
+++ b/test/webkit/stack-unwinding.js
@@ -62,4 +62,3 @@
} catch (e) {
testPassed("Exception thrown and caught");
}
-
diff --git a/test/webkit/string-trim.js b/test/webkit/string-trim.js
index e644754..27f99d5 100644
--- a/test/webkit/string-trim.js
+++ b/test/webkit/string-trim.js
@@ -92,4 +92,3 @@
shouldBe("trimLeft.call("+testValues[i]+")", "'"+eval(testValues[i])+"'");
shouldBe("trimRight.call("+testValues[i]+")", "'"+eval(testValues[i])+"'");
}
-
diff --git a/test/webkit/throw-from-finally.js b/test/webkit/throw-from-finally.js
index baa4ae8..183245d 100644
--- a/test/webkit/throw-from-finally.js
+++ b/test/webkit/throw-from-finally.js
@@ -78,4 +78,3 @@
}
shouldBe("\"\" + events", "\"1:try,1:finally,2:finally,2:thingy,3:thingy,3:finally,4:thingy,4:finally,4:another thingy,5:hi,5:wat\"");
-
diff --git a/test/webkit/try-catch-try-try-catch-try-finally-return-catch-finally.js b/test/webkit/try-catch-try-try-catch-try-finally-return-catch-finally.js
index 140ba7f..1547bdf 100644
--- a/test/webkit/try-catch-try-try-catch-try-finally-return-catch-finally.js
+++ b/test/webkit/try-catch-try-try-catch-try-finally-return-catch-finally.js
@@ -50,4 +50,3 @@
} catch (e) {
testPassed("It worked.");
}
-
diff --git a/test/webkit/try-try-return-finally-finally.js b/test/webkit/try-try-return-finally-finally.js
index 8eef642..4861824 100644
--- a/test/webkit/try-try-return-finally-finally.js
+++ b/test/webkit/try-try-return-finally-finally.js
@@ -45,4 +45,3 @@
} catch (e) {
testPassed("It worked.");
}
-
diff --git a/test/webkit/var-declarations-zero-width.js b/test/webkit/var-declarations-zero-width.js
index 8b5f90f..e7b7c45 100644
--- a/test/webkit/var-declarations-zero-width.js
+++ b/test/webkit/var-declarations-zero-width.js
@@ -25,4 +25,4 @@
shouldBe("var x\u200c = 42; x\u200c", "42");
shouldBe("var x\u200d = 43; x\u200d", "43");
-shouldBe("var x\u200c\u200d = 44; x\u200c\u200d", "44");
\ No newline at end of file
+shouldBe("var x\u200c\u200d = 44; x\u200c\u200d", "44");
diff --git a/tools/consarray.js b/tools/consarray.js
index c67abb7..dbce1de 100644
--- a/tools/consarray.js
+++ b/tools/consarray.js
@@ -90,4 +90,3 @@
this.data = data;
this.next = next;
};
-
diff --git a/tools/generate-trig-table.py b/tools/generate-trig-table.py
index 14d4472..c03cf73 100644
--- a/tools/generate-trig-table.py
+++ b/tools/generate-trig-table.py
@@ -81,4 +81,3 @@
if __name__ == "__main__":
main()
-
diff --git a/tools/presubmit.py b/tools/presubmit.py
index 1ab6347..56eac8e 100755
--- a/tools/presubmit.py
+++ b/tools/presubmit.py
@@ -191,7 +191,8 @@
return True
def IgnoreDir(self, name):
- return name.startswith('.') or name == 'data' or name == 'sputniktests'
+ return (name.startswith('.') or
+ name in ('data', 'kraken', 'octane', 'sunspider'))
def IgnoreFile(self, name):
return name.startswith('.')
@@ -312,12 +313,8 @@
return ['.']
def IgnoreDir(self, name):
- return (super(SourceProcessor, self).IgnoreDir(name)
- or (name == 'third_party')
- or (name == 'gyp')
- or (name == 'out')
- or (name == 'obj')
- or (name == 'DerivedSources'))
+ return (super(SourceProcessor, self).IgnoreDir(name) or
+ name in ('third_party', 'gyp', 'out', 'obj', 'DerivedSources'))
IGNORE_COPYRIGHTS = ['cpplint.py',
'daemon.py',
@@ -365,6 +362,9 @@
else:
print "%s has trailing whitespaces in line %s." % (name, linenumbers)
result = False
+ if not contents.endswith('\n') or contents.endswith('\n\n'):
+ print "%s does not end with a single new line." % name
+ result = False
# Check two empty lines between declarations.
if name.endswith(".cc"):
line = 0
diff --git a/tools/testrunner/local/junit_output.py b/tools/testrunner/local/junit_output.py
index 437adb1..d2748fe 100644
--- a/tools/testrunner/local/junit_output.py
+++ b/tools/testrunner/local/junit_output.py
@@ -46,4 +46,3 @@
def FinishAndWrite(self, file):
xml.ElementTree(self.root).write(file, "UTF-8")
-
diff --git a/tools/tickprocessor.js b/tools/tickprocessor.js
index ff52541..187e647 100644
--- a/tools/tickprocessor.js
+++ b/tools/tickprocessor.js
@@ -950,4 +950,3 @@
}
quit(2);
};
-