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

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

Issue 12300018: Made Isolate a mandatory parameter for everything Handle-related. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed CreateCode calls. Be nicer to MIPS. Created 7 years, 10 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-compiler.cc ('k') | test/cctest/test-disasm-ia32.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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 context_->Enter(); 136 context_->Enter();
137 } 137 }
138 inline ~DebugLocalContext() { 138 inline ~DebugLocalContext() {
139 context_->Exit(); 139 context_->Exit();
140 context_.Dispose(context_->GetIsolate()); 140 context_.Dispose(context_->GetIsolate());
141 } 141 }
142 inline v8::Context* operator->() { return *context_; } 142 inline v8::Context* operator->() { return *context_; }
143 inline v8::Context* operator*() { return *context_; } 143 inline v8::Context* operator*() { return *context_; }
144 inline bool IsReady() { return !context_.IsEmpty(); } 144 inline bool IsReady() { return !context_.IsEmpty(); }
145 void ExposeDebug() { 145 void ExposeDebug() {
146 v8::internal::Isolate* isolate = v8::internal::Isolate::Current(); 146 v8::internal::Isolate* isolate =
147 reinterpret_cast<v8::internal::Isolate*>(context_->GetIsolate());
147 v8::internal::Debug* debug = isolate->debug(); 148 v8::internal::Debug* debug = isolate->debug();
148 // Expose the debug context global object in the global object for testing. 149 // Expose the debug context global object in the global object for testing.
149 debug->Load(); 150 debug->Load();
150 debug->debug_context()->set_security_token( 151 debug->debug_context()->set_security_token(
151 v8::Utils::OpenHandle(*context_)->security_token()); 152 v8::Utils::OpenHandle(*context_)->security_token());
152 153
153 Handle<JSGlobalProxy> global(Handle<JSGlobalProxy>::cast( 154 Handle<JSGlobalProxy> global(Handle<JSGlobalProxy>::cast(
154 v8::Utils::OpenHandle(*context_->Global()))); 155 v8::Utils::OpenHandle(*context_->Global())));
155 Handle<v8::internal::String> debug_string = 156 Handle<v8::internal::String> debug_string =
156 FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("debug")); 157 FACTORY->LookupOneByteSymbol(STATIC_ASCII_VECTOR("debug"));
157 SetProperty(isolate, global, debug_string, 158 SetProperty(isolate, global, debug_string,
158 Handle<Object>(debug->debug_context()->global_proxy()), DONT_ENUM, 159 Handle<Object>(debug->debug_context()->global_proxy(), isolate),
159 ::v8::internal::kNonStrictMode); 160 DONT_ENUM,
161 ::v8::internal::kNonStrictMode);
160 } 162 }
161 163
162 private: 164 private:
163 v8::Persistent<v8::Context> context_; 165 v8::Persistent<v8::Context> context_;
164 }; 166 };
165 167
166 168
167 // --- H e l p e r F u n c t i o n s 169 // --- H e l p e r F u n c t i o n s
168 170
169 171
(...skipping 21 matching lines...) Expand all
191 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); 193 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun);
192 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); 194 Handle<v8::internal::SharedFunctionInfo> shared(f->shared());
193 return Debug::HasDebugInfo(shared); 195 return Debug::HasDebugInfo(shared);
194 } 196 }
195 197
196 198
197 // Set a break point in a function and return the associated break point 199 // Set a break point in a function and return the associated break point
198 // number. 200 // number.
199 static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) { 201 static int SetBreakPoint(Handle<v8::internal::JSFunction> fun, int position) {
200 static int break_point = 0; 202 static int break_point = 0;
201 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); 203 v8::internal::Isolate* isolate = fun->GetIsolate();
204 v8::internal::Debug* debug = isolate->debug();
202 debug->SetBreakPoint( 205 debug->SetBreakPoint(
203 fun, 206 fun,
204 Handle<Object>(v8::internal::Smi::FromInt(++break_point)), 207 Handle<Object>(v8::internal::Smi::FromInt(++break_point), isolate),
205 &position); 208 &position);
206 return break_point; 209 return break_point;
207 } 210 }
208 211
209 212
210 // Set a break point in a function and return the associated break point 213 // Set a break point in a function and return the associated break point
211 // number. 214 // number.
212 static int SetBreakPoint(v8::Handle<v8::Function> fun, int position) { 215 static int SetBreakPoint(v8::Handle<v8::Function> fun, int position) {
213 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position); 216 return SetBreakPoint(v8::Utils::OpenHandle(*fun), position);
214 } 217 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 v8::Handle<v8::String> str = v8::String::New(buffer.start()); 278 v8::Handle<v8::String> str = v8::String::New(buffer.start());
276 v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run(); 279 v8::Handle<v8::Value> value = v8::Script::Compile(str)->Run();
277 CHECK(!try_catch.HasCaught()); 280 CHECK(!try_catch.HasCaught());
278 return value->Int32Value(); 281 return value->Int32Value();
279 } 282 }
280 } 283 }
281 284
282 285
283 // Clear a break point. 286 // Clear a break point.
284 static void ClearBreakPoint(int break_point) { 287 static void ClearBreakPoint(int break_point) {
285 v8::internal::Debug* debug = v8::internal::Isolate::Current()->debug(); 288 v8::internal::Isolate* isolate = v8::internal::Isolate::Current();
289 v8::internal::Debug* debug = isolate->debug();
286 debug->ClearBreakPoint( 290 debug->ClearBreakPoint(
287 Handle<Object>(v8::internal::Smi::FromInt(break_point))); 291 Handle<Object>(v8::internal::Smi::FromInt(break_point), isolate));
288 } 292 }
289 293
290 294
291 // Clear a break point using the global Debug object. 295 // Clear a break point using the global Debug object.
292 static void ClearBreakPointFromJS(int break_point_number) { 296 static void ClearBreakPointFromJS(int break_point_number) {
293 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer; 297 EmbeddedVector<char, SMALL_STRING_BUFFER_SIZE> buffer;
294 OS::SNPrintF(buffer, 298 OS::SNPrintF(buffer,
295 "debug.Debug.clearBreakPoint(%d)", 299 "debug.Debug.clearBreakPoint(%d)",
296 break_point_number); 300 break_point_number);
297 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0'; 301 buffer[SMALL_STRING_BUFFER_SIZE - 1] = '\0';
(...skipping 7225 matching lines...) Expand 10 before | Expand all | Expand 10 after
7523 TEST(LiveEditDisabled) { 7527 TEST(LiveEditDisabled) {
7524 v8::internal::FLAG_allow_natives_syntax = true; 7528 v8::internal::FLAG_allow_natives_syntax = true;
7525 v8::HandleScope scope; 7529 v8::HandleScope scope;
7526 LocalContext context; 7530 LocalContext context;
7527 v8::Debug::SetLiveEditEnabled(false); 7531 v8::Debug::SetLiveEditEnabled(false);
7528 CompileRun("%LiveEditCompareStrings('', '')"); 7532 CompileRun("%LiveEditCompareStrings('', '')");
7529 } 7533 }
7530 7534
7531 7535
7532 #endif // ENABLE_DEBUGGER_SUPPORT 7536 #endif // ENABLE_DEBUGGER_SUPPORT
OLDNEW
« no previous file with comments | « test/cctest/test-compiler.cc ('k') | test/cctest/test-disasm-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698