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

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

Issue 1775973002: Add GetProperty/GetElement to JSReceiver and use it where possible (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
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 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 parser_materialized_literals = function->materialized_literal_count(); 1592 parser_materialized_literals = function->materialized_literal_count();
1593 } 1593 }
1594 } 1594 }
1595 1595
1596 // Check that preparsing fails iff parsing fails. 1596 // Check that preparsing fails iff parsing fails.
1597 if (function == NULL) { 1597 if (function == NULL) {
1598 // Extract exception from the parser. 1598 // Extract exception from the parser.
1599 CHECK(isolate->has_pending_exception()); 1599 CHECK(isolate->has_pending_exception());
1600 i::Handle<i::JSObject> exception_handle( 1600 i::Handle<i::JSObject> exception_handle(
1601 i::JSObject::cast(isolate->pending_exception())); 1601 i::JSObject::cast(isolate->pending_exception()));
1602 i::Handle<i::String> message_string = 1602 i::Handle<i::String> message_string = i::Handle<i::String>::cast(
1603 i::Handle<i::String>::cast(i::Object::GetProperty( 1603 i::JSReceiver::GetProperty(isolate, exception_handle, "message")
1604 isolate, exception_handle, "message").ToHandleChecked()); 1604 .ToHandleChecked());
1605 1605
1606 if (result == kSuccess) { 1606 if (result == kSuccess) {
1607 v8::base::OS::Print( 1607 v8::base::OS::Print(
1608 "Parser failed on:\n" 1608 "Parser failed on:\n"
1609 "\t%s\n" 1609 "\t%s\n"
1610 "with error:\n" 1610 "with error:\n"
1611 "\t%s\n" 1611 "\t%s\n"
1612 "However, we expected no error.", 1612 "However, we expected no error.",
1613 source->ToCString().get(), message_string->ToCString().get()); 1613 source->ToCString().get(), message_string->ToCString().get());
1614 CHECK(false); 1614 CHECK(false);
(...skipping 4120 matching lines...) Expand 10 before | Expand all | Expand 10 after
5735 // Show that parsing as a module works 5735 // Show that parsing as a module works
5736 { 5736 {
5737 i::Handle<i::Script> script = factory->NewScript(source); 5737 i::Handle<i::Script> script = factory->NewScript(source);
5738 i::Zone zone; 5738 i::Zone zone;
5739 i::ParseInfo info(&zone, script); 5739 i::ParseInfo info(&zone, script);
5740 i::Parser parser(&info); 5740 i::Parser parser(&info);
5741 info.set_module(); 5741 info.set_module();
5742 if (!parser.Parse(&info)) { 5742 if (!parser.Parse(&info)) {
5743 i::Handle<i::JSObject> exception_handle( 5743 i::Handle<i::JSObject> exception_handle(
5744 i::JSObject::cast(isolate->pending_exception())); 5744 i::JSObject::cast(isolate->pending_exception()));
5745 i::Handle<i::String> message_string = 5745 i::Handle<i::String> message_string = i::Handle<i::String>::cast(
5746 i::Handle<i::String>::cast(i::Object::GetProperty( 5746 i::JSReceiver::GetProperty(isolate, exception_handle, "message")
5747 isolate, exception_handle, "message").ToHandleChecked()); 5747 .ToHandleChecked());
5748 5748
5749 v8::base::OS::Print( 5749 v8::base::OS::Print(
5750 "Parser failed on:\n" 5750 "Parser failed on:\n"
5751 "\t%s\n" 5751 "\t%s\n"
5752 "with error:\n" 5752 "with error:\n"
5753 "\t%s\n" 5753 "\t%s\n"
5754 "However, we expected no error.", 5754 "However, we expected no error.",
5755 source->ToCString().get(), message_string->ToCString().get()); 5755 source->ToCString().get(), message_string->ToCString().get());
5756 CHECK(false); 5756 CHECK(false);
5757 } 5757 }
(...skipping 2320 matching lines...) Expand 10 before | Expand all | Expand 10 after
8078 RunParserSyncTest(sloppy_context, error_data, kError); 8078 RunParserSyncTest(sloppy_context, error_data, kError);
8079 RunParserSyncTest(sloppy_context, error_data, kError, NULL, 0, 8079 RunParserSyncTest(sloppy_context, error_data, kError, NULL, 0,
8080 restrictive_flags, arraysize(restrictive_flags)); 8080 restrictive_flags, arraysize(restrictive_flags));
8081 RunParserSyncTest(sloppy_context, unrestricted_data, kSuccess); 8081 RunParserSyncTest(sloppy_context, unrestricted_data, kSuccess);
8082 RunParserSyncTest(sloppy_context, unrestricted_data, kError, NULL, 0, 8082 RunParserSyncTest(sloppy_context, unrestricted_data, kError, NULL, 0,
8083 restrictive_flags, arraysize(restrictive_flags)); 8083 restrictive_flags, arraysize(restrictive_flags));
8084 RunParserSyncTest(sloppy_context, sloppy_data, kSuccess); 8084 RunParserSyncTest(sloppy_context, sloppy_data, kSuccess);
8085 RunParserSyncTest(sloppy_context, sloppy_data, kSuccess, restrictive_flags, 8085 RunParserSyncTest(sloppy_context, sloppy_data, kSuccess, restrictive_flags,
8086 arraysize(restrictive_flags)); 8086 arraysize(restrictive_flags));
8087 } 8087 }
OLDNEW
« no previous file with comments | « test/cctest/test-object-observe.cc ('k') | test/unittests/compiler/js-builtin-reducer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698