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

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

Issue 14793004: deprecate Context::New which returns Persistent (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: use Reset instead of operator= Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/test-log.cc ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 const char* data() const { return data_; } 169 const char* data() const { return data_; }
170 size_t length() const { return length_; } 170 size_t length() const { return length_; }
171 171
172 private: 172 private:
173 const char* data_; 173 const char* data_;
174 size_t length_; 174 size_t length_;
175 }; 175 };
176 176
177 177
178 TEST(Preparsing) { 178 TEST(Preparsing) {
179 v8::HandleScope handles(v8::Isolate::GetCurrent()); 179 v8::Isolate* isolate = v8::Isolate::GetCurrent();
180 v8::Persistent<v8::Context> context = v8::Context::New(); 180 v8::HandleScope handles(isolate);
181 v8::Context::Scope context_scope(v8::Isolate::GetCurrent(), context); 181 v8::Local<v8::Context> context = v8::Context::New(isolate);
182 v8::Context::Scope context_scope(context);
182 int marker; 183 int marker;
183 i::Isolate::Current()->stack_guard()->SetStackLimit( 184 i::Isolate::Current()->stack_guard()->SetStackLimit(
184 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024); 185 reinterpret_cast<uintptr_t>(&marker) - 128 * 1024);
185 186
186 // Source containing functions that might be lazily compiled and all types 187 // Source containing functions that might be lazily compiled and all types
187 // of symbols (string, propertyName, regexp). 188 // of symbols (string, propertyName, regexp).
188 const char* source = 189 const char* source =
189 "var x = 42;" 190 "var x = 42;"
190 "function foo(a) { return function nolazy(b) { return a + b; } }" 191 "function foo(a) { return function nolazy(b) { return a + b; } }"
191 "function bar(a) { if (a) return function lazy(b) { return b; } }" 192 "function bar(a) { if (a) return function lazy(b) { return b; } }"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 int32_t c1 = uc16_stream.Advance(); 536 int32_t c1 = uc16_stream.Advance();
536 int32_t c2 = string_stream.Advance(); 537 int32_t c2 = string_stream.Advance();
537 int32_t c3 = utf8_stream.Advance(); 538 int32_t c3 = utf8_stream.Advance();
538 CHECK_LT(c1, 0); 539 CHECK_LT(c1, 0);
539 CHECK_LT(c2, 0); 540 CHECK_LT(c2, 0);
540 CHECK_LT(c3, 0); 541 CHECK_LT(c3, 0);
541 } 542 }
542 543
543 544
544 TEST(CharacterStreams) { 545 TEST(CharacterStreams) {
545 v8::HandleScope handles(v8::Isolate::GetCurrent()); 546 v8::Isolate* isolate = v8::Isolate::GetCurrent();
546 v8::Persistent<v8::Context> context = v8::Context::New(); 547 v8::HandleScope handles(isolate);
547 v8::Context::Scope context_scope(v8::Isolate::GetCurrent(), context); 548 v8::Local<v8::Context> context = v8::Context::New(isolate);
549 v8::Context::Scope context_scope(context);
548 550
549 TestCharacterStream("abc\0\n\r\x7f", 7); 551 TestCharacterStream("abc\0\n\r\x7f", 7);
550 static const unsigned kBigStringSize = 4096; 552 static const unsigned kBigStringSize = 4096;
551 char buffer[kBigStringSize + 1]; 553 char buffer[kBigStringSize + 1];
552 for (unsigned i = 0; i < kBigStringSize; i++) { 554 for (unsigned i = 0; i < kBigStringSize; i++) {
553 buffer[i] = static_cast<char>(i & 0x7f); 555 buffer[i] = static_cast<char>(i & 0x7f);
554 } 556 }
555 TestCharacterStream(buffer, kBigStringSize); 557 TestCharacterStream(buffer, kBigStringSize);
556 558
557 TestCharacterStream(buffer, kBigStringSize, 576, 3298); 559 TestCharacterStream(buffer, kBigStringSize, 576, 3298);
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 " b = function() { \n" 1298 " b = function() { \n"
1297 " 01; \n" 1299 " 01; \n"
1298 " }; \n" 1300 " }; \n"
1299 "}; \n"; 1301 "}; \n";
1300 v8::Script::Compile(v8::String::New(script)); 1302 v8::Script::Compile(v8::String::New(script));
1301 CHECK(try_catch.HasCaught()); 1303 CHECK(try_catch.HasCaught());
1302 v8::String::Utf8Value exception(try_catch.Exception()); 1304 v8::String::Utf8Value exception(try_catch.Exception());
1303 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.", 1305 CHECK_EQ("SyntaxError: Octal literals are not allowed in strict mode.",
1304 *exception); 1306 *exception);
1305 } 1307 }
OLDNEW
« no previous file with comments | « test/cctest/test-log.cc ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698