OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 public: | 60 public: |
61 explicit ScopedLoggerInitializer(bool prof_lazy) | 61 explicit ScopedLoggerInitializer(bool prof_lazy) |
62 : saved_log_(i::FLAG_log), | 62 : saved_log_(i::FLAG_log), |
63 saved_prof_lazy_(i::FLAG_prof_lazy), | 63 saved_prof_lazy_(i::FLAG_prof_lazy), |
64 saved_prof_(i::FLAG_prof), | 64 saved_prof_(i::FLAG_prof), |
65 saved_prof_auto_(i::FLAG_prof_auto), | 65 saved_prof_auto_(i::FLAG_prof_auto), |
66 temp_file_(NULL), | 66 temp_file_(NULL), |
67 // Need to run this prior to creating the scope. | 67 // Need to run this prior to creating the scope. |
68 trick_to_run_init_flags_(init_flags_(prof_lazy)), | 68 trick_to_run_init_flags_(init_flags_(prof_lazy)), |
69 scope_(v8::Isolate::GetCurrent()), | 69 scope_(v8::Isolate::GetCurrent()), |
70 env_(*v8::Context::New()), | 70 env_(v8::Context::New(v8::Isolate::GetCurrent())), |
71 logger_(i::Isolate::Current()->logger()) { | 71 logger_(i::Isolate::Current()->logger()) { |
72 env_->Enter(); | 72 env_->Enter(); |
73 } | 73 } |
74 | 74 |
75 ~ScopedLoggerInitializer() { | 75 ~ScopedLoggerInitializer() { |
76 env_->Exit(); | 76 env_->Exit(); |
77 logger_->TearDown(); | 77 logger_->TearDown(); |
78 if (temp_file_ != NULL) fclose(temp_file_); | 78 if (temp_file_ != NULL) fclose(temp_file_); |
79 i::FLAG_prof_lazy = saved_prof_lazy_; | 79 i::FLAG_prof_lazy = saved_prof_lazy_; |
80 i::FLAG_prof = saved_prof_; | 80 i::FLAG_prof = saved_prof_; |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 v8::Local<v8::String> s = result->ToString(); | 571 v8::Local<v8::String> s = result->ToString(); |
572 i::ScopedVector<char> data(s->Utf8Length() + 1); | 572 i::ScopedVector<char> data(s->Utf8Length() + 1); |
573 CHECK_NE(NULL, data.start()); | 573 CHECK_NE(NULL, data.start()); |
574 s->WriteUtf8(data.start()); | 574 s->WriteUtf8(data.start()); |
575 printf("%s\n", data.start()); | 575 printf("%s\n", data.start()); |
576 // Make sure that our output is written prior crash due to CHECK failure. | 576 // Make sure that our output is written prior crash due to CHECK failure. |
577 fflush(stdout); | 577 fflush(stdout); |
578 CHECK(false); | 578 CHECK(false); |
579 } | 579 } |
580 } | 580 } |
OLD | NEW |