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

Side by Side Diff: test/cctest/test-parsing.cc

Issue 110573004: Merge bleeding_edge 17696:18016. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 v8::Context::Scope context_scope( 1320 v8::Context::Scope context_scope(
1322 v8::Context::New(CcTest::isolate())); 1321 v8::Context::New(CcTest::isolate()));
1323 v8::TryCatch try_catch; 1322 v8::TryCatch try_catch;
1324 const char* script = 1323 const char* script =
1325 "\"use strict\"; \n" 1324 "\"use strict\"; \n"
1326 "a = function() { \n" 1325 "a = function() { \n"
1327 " b = function() { \n" 1326 " b = function() { \n"
1328 " 01; \n" 1327 " 01; \n"
1329 " }; \n" 1328 " }; \n"
1330 "}; \n"; 1329 "}; \n";
1331 v8::Script::Compile(v8::String::New(script)); 1330 v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(), script));
1332 CHECK(try_catch.HasCaught()); 1331 CHECK(try_catch.HasCaught());
1333 v8::String::Utf8Value exception(try_catch.Exception()); 1332 v8::String::Utf8Value exception(try_catch.Exception());
1334 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", 1333 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.",
1335 *exception); 1334 *exception);
1336 } 1335 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698