| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 // Compile and run the supplied source and return the requested function. | 172 // Compile and run the supplied source and return the requested function. |
| 173 static v8::Local<v8::Function> CompileFunction(const char* source, | 173 static v8::Local<v8::Function> CompileFunction(const char* source, |
| 174 const char* function_name) { | 174 const char* function_name) { |
| 175 v8::Script::Compile(v8::String::New(source))->Run(); | 175 v8::Script::Compile(v8::String::New(source))->Run(); |
| 176 return v8::Local<v8::Function>::Cast( | 176 return v8::Local<v8::Function>::Cast( |
| 177 v8::Context::GetCurrent()->Global()->Get(v8::String::New(function_name))); | 177 v8::Context::GetCurrent()->Global()->Get(v8::String::New(function_name))); |
| 178 } | 178 } |
| 179 | 179 |
| 180 | 180 |
| 181 // Helper function that compiles and runs the source. |
| 182 static v8::Local<v8::Value> CompileRun(const char* source) { |
| 183 return v8::Script::Compile(v8::String::New(source))->Run(); |
| 184 } |
| 185 |
| 186 |
| 181 // Is there any debug info for the function? | 187 // Is there any debug info for the function? |
| 182 static bool HasDebugInfo(v8::Handle<v8::Function> fun) { | 188 static bool HasDebugInfo(v8::Handle<v8::Function> fun) { |
| 183 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); | 189 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); |
| 184 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); | 190 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); |
| 185 return Debug::HasDebugInfo(shared); | 191 return Debug::HasDebugInfo(shared); |
| 186 } | 192 } |
| 187 | 193 |
| 188 | 194 |
| 189 // Set a break point in a function and return the associated break point | 195 // Set a break point in a function and return the associated break point |
| 190 // number. | 196 // number. |
| (...skipping 5240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5431 v8::Script::New( | 5437 v8::Script::New( |
| 5432 v8::String::New( | 5438 v8::String::New( |
| 5433 "function runTest(mirror) {" | 5439 "function runTest(mirror) {" |
| 5434 " return mirror.isString() && (mirror.length() == 5);" | 5440 " return mirror.isString() && (mirror.length() == 5);" |
| 5435 "}" | 5441 "}" |
| 5436 "" | 5442 "" |
| 5437 "runTest;"))->Run()); | 5443 "runTest;"))->Run()); |
| 5438 v8::Handle<v8::Value> result = run_test->Call(env->Global(), 1, &obj); | 5444 v8::Handle<v8::Value> result = run_test->Call(env->Global(), 1, &obj); |
| 5439 CHECK(result->IsTrue()); | 5445 CHECK(result->IsTrue()); |
| 5440 } | 5446 } |
| OLD | NEW |