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 | |
187 // Is there any debug info for the function? | 181 // Is there any debug info for the function? |
188 static bool HasDebugInfo(v8::Handle<v8::Function> fun) { | 182 static bool HasDebugInfo(v8::Handle<v8::Function> fun) { |
189 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); | 183 Handle<v8::internal::JSFunction> f = v8::Utils::OpenHandle(*fun); |
190 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); | 184 Handle<v8::internal::SharedFunctionInfo> shared(f->shared()); |
191 return Debug::HasDebugInfo(shared); | 185 return Debug::HasDebugInfo(shared); |
192 } | 186 } |
193 | 187 |
194 | 188 |
195 // Set a break point in a function and return the associated break point | 189 // Set a break point in a function and return the associated break point |
196 // number. | 190 // number. |
(...skipping 5240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5437 v8::Script::New( | 5431 v8::Script::New( |
5438 v8::String::New( | 5432 v8::String::New( |
5439 "function runTest(mirror) {" | 5433 "function runTest(mirror) {" |
5440 " return mirror.isString() && (mirror.length() == 5);" | 5434 " return mirror.isString() && (mirror.length() == 5);" |
5441 "}" | 5435 "}" |
5442 "" | 5436 "" |
5443 "runTest;"))->Run()); | 5437 "runTest;"))->Run()); |
5444 v8::Handle<v8::Value> result = run_test->Call(env->Global(), 1, &obj); | 5438 v8::Handle<v8::Value> result = run_test->Call(env->Global(), 1, &obj); |
5445 CHECK(result->IsTrue()); | 5439 CHECK(result->IsTrue()); |
5446 } | 5440 } |
OLD | NEW |