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

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

Issue 12716010: Added a version of the v8::HandleScope constructor with an Isolate and use that consistently. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed rest Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 class ScopedLoggerInitializer { 54 class ScopedLoggerInitializer {
55 public: 55 public:
56 explicit ScopedLoggerInitializer(bool prof_lazy) 56 explicit ScopedLoggerInitializer(bool prof_lazy)
57 : saved_log_(i::FLAG_log), 57 : saved_log_(i::FLAG_log),
58 saved_prof_lazy_(i::FLAG_prof_lazy), 58 saved_prof_lazy_(i::FLAG_prof_lazy),
59 saved_prof_(i::FLAG_prof), 59 saved_prof_(i::FLAG_prof),
60 saved_prof_auto_(i::FLAG_prof_auto), 60 saved_prof_auto_(i::FLAG_prof_auto),
61 temp_file_(NULL), 61 temp_file_(NULL),
62 // Need to run this prior to creating the scope. 62 // Need to run this prior to creating the scope.
63 trick_to_run_init_flags_(init_flags_(prof_lazy)), 63 trick_to_run_init_flags_(init_flags_(prof_lazy)),
64 scope_(), 64 scope_(v8::Isolate::GetCurrent()),
65 env_(v8::Context::New()) { 65 env_(v8::Context::New()) {
66 env_->Enter(); 66 env_->Enter();
67 } 67 }
68 68
69 ~ScopedLoggerInitializer() { 69 ~ScopedLoggerInitializer() {
70 env_->Exit(); 70 env_->Exit();
71 LOGGER->TearDown(); 71 LOGGER->TearDown();
72 if (temp_file_ != NULL) fclose(temp_file_); 72 if (temp_file_ != NULL) fclose(temp_file_);
73 i::FLAG_prof_lazy = saved_prof_lazy_; 73 i::FLAG_prof_lazy = saved_prof_lazy_;
74 i::FLAG_prof = saved_prof_; 74 i::FLAG_prof = saved_prof_;
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 virtual ~SimpleExternalString() {} 358 virtual ~SimpleExternalString() {}
359 virtual size_t length() const { return utf_source_.length(); } 359 virtual size_t length() const { return utf_source_.length(); }
360 virtual const uint16_t* data() const { return utf_source_.start(); } 360 virtual const uint16_t* data() const { return utf_source_.start(); }
361 private: 361 private:
362 i::ScopedVector<uint16_t> utf_source_; 362 i::ScopedVector<uint16_t> utf_source_;
363 }; 363 };
364 364
365 } // namespace 365 } // namespace
366 366
367 TEST(Issue23768) { 367 TEST(Issue23768) {
368 v8::HandleScope scope; 368 v8::HandleScope scope(v8::Isolate::GetCurrent());
369 v8::Handle<v8::Context> env = v8::Context::New(); 369 v8::Handle<v8::Context> env = v8::Context::New();
370 env->Enter(); 370 env->Enter();
371 371
372 SimpleExternalString source_ext_str("(function ext() {})();"); 372 SimpleExternalString source_ext_str("(function ext() {})();");
373 v8::Local<v8::String> source = v8::String::NewExternal(&source_ext_str); 373 v8::Local<v8::String> source = v8::String::NewExternal(&source_ext_str);
374 // Script needs to have a name in order to trigger InitLineEnds execution. 374 // Script needs to have a name in order to trigger InitLineEnds execution.
375 v8::Handle<v8::String> origin = v8::String::New("issue-23768-test"); 375 v8::Handle<v8::String> origin = v8::String::New("issue-23768-test");
376 v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin); 376 v8::Handle<v8::Script> evil_script = v8::Script::Compile(source, origin);
377 CHECK(!evil_script.IsEmpty()); 377 CHECK(!evil_script.IsEmpty());
378 CHECK(!evil_script->Run().IsEmpty()); 378 CHECK(!evil_script->Run().IsEmpty());
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 v8::Local<v8::String> s = result->ToString(); 556 v8::Local<v8::String> s = result->ToString();
557 i::ScopedVector<char> data(s->Length() + 1); 557 i::ScopedVector<char> data(s->Length() + 1);
558 CHECK_NE(NULL, data.start()); 558 CHECK_NE(NULL, data.start());
559 s->WriteAscii(data.start()); 559 s->WriteAscii(data.start());
560 printf("%s\n", data.start()); 560 printf("%s\n", data.start());
561 // Make sure that our output is written prior crash due to CHECK failure. 561 // Make sure that our output is written prior crash due to CHECK failure.
562 fflush(stdout); 562 fflush(stdout);
563 CHECK(false); 563 CHECK(false);
564 } 564 }
565 } 565 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698