OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen); | 1043 CHECK_EQ(inner_scope->end_position(), kPrefixLen + kInnerLen); |
1044 } | 1044 } |
1045 } | 1045 } |
1046 | 1046 |
1047 | 1047 |
1048 i::Handle<i::String> FormatMessage(i::ScriptDataImpl* data) { | 1048 i::Handle<i::String> FormatMessage(i::ScriptDataImpl* data) { |
1049 i::Isolate* isolate = CcTest::i_isolate(); | 1049 i::Isolate* isolate = CcTest::i_isolate(); |
1050 i::Factory* factory = isolate->factory(); | 1050 i::Factory* factory = isolate->factory(); |
1051 const char* message = data->BuildMessage(); | 1051 const char* message = data->BuildMessage(); |
1052 i::Handle<i::String> format = v8::Utils::OpenHandle( | 1052 i::Handle<i::String> format = v8::Utils::OpenHandle( |
1053 *v8::String::New(message)); | 1053 *v8::String::NewFromUtf8(CcTest::isolate(), message)); |
1054 i::Vector<const char*> args = data->BuildArgs(); | 1054 i::Vector<const char*> args = data->BuildArgs(); |
1055 i::Handle<i::JSArray> args_array = factory->NewJSArray(args.length()); | 1055 i::Handle<i::JSArray> args_array = factory->NewJSArray(args.length()); |
1056 for (int i = 0; i < args.length(); i++) { | 1056 for (int i = 0; i < args.length(); i++) { |
1057 i::JSArray::SetElement(args_array, | 1057 i::JSArray::SetElement( |
1058 i, | 1058 args_array, i, v8::Utils::OpenHandle(*v8::String::NewFromUtf8( |
1059 v8::Utils::OpenHandle(*v8::String::New(args[i])), | 1059 CcTest::isolate(), args[i])), |
1060 NONE, | 1060 NONE, i::kNonStrictMode); |
1061 i::kNonStrictMode); | |
1062 } | 1061 } |
1063 i::Handle<i::JSObject> builtins(isolate->js_builtins_object()); | 1062 i::Handle<i::JSObject> builtins(isolate->js_builtins_object()); |
1064 i::Handle<i::Object> format_fun = | 1063 i::Handle<i::Object> format_fun = |
1065 i::GetProperty(builtins, "FormatMessage"); | 1064 i::GetProperty(builtins, "FormatMessage"); |
1066 i::Handle<i::Object> arg_handles[] = { format, args_array }; | 1065 i::Handle<i::Object> arg_handles[] = { format, args_array }; |
1067 bool has_exception = false; | 1066 bool has_exception = false; |
1068 i::Handle<i::Object> result = i::Execution::Call( | 1067 i::Handle<i::Object> result = i::Execution::Call( |
1069 isolate, format_fun, builtins, 2, arg_handles, &has_exception); | 1068 isolate, format_fun, builtins, 2, arg_handles, &has_exception); |
1070 CHECK(!has_exception); | 1069 CHECK(!has_exception); |
1071 CHECK(result->IsString()); | 1070 CHECK(result->IsString()); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 v8::Context::Scope context_scope( | 1321 v8::Context::Scope context_scope( |
1323 v8::Context::New(CcTest::isolate())); | 1322 v8::Context::New(CcTest::isolate())); |
1324 v8::TryCatch try_catch; | 1323 v8::TryCatch try_catch; |
1325 const char* script = | 1324 const char* script = |
1326 "\"use strict\"; \n" | 1325 "\"use strict\"; \n" |
1327 "a = function() { \n" | 1326 "a = function() { \n" |
1328 " b = function() { \n" | 1327 " b = function() { \n" |
1329 " 01; \n" | 1328 " 01; \n" |
1330 " }; \n" | 1329 " }; \n" |
1331 "}; \n"; | 1330 "}; \n"; |
1332 v8::Script::Compile(v8::String::New(script)); | 1331 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script)); |
1333 CHECK(try_catch.HasCaught()); | 1332 CHECK(try_catch.HasCaught()); |
1334 v8::String::Utf8Value exception(try_catch.Exception()); | 1333 v8::String::Utf8Value exception(try_catch.Exception()); |
1335 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", | 1334 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", |
1336 *exception); | 1335 *exception); |
1337 } | 1336 } |
OLD | NEW |