OLD | NEW |
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 17519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17530 v8::Script::Compile(script, &origin)->Run(); | 17530 v8::Script::Compile(script, &origin)->Run(); |
17531 v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast( | 17531 v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast( |
17532 env->Global()->Get(v8::String::New("foo"))); | 17532 env->Global()->Get(v8::String::New("foo"))); |
17533 v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast( | 17533 v8::Local<v8::Function> bar = v8::Local<v8::Function>::Cast( |
17534 env->Global()->Get(v8::String::New("bar"))); | 17534 env->Global()->Get(v8::String::New("bar"))); |
17535 CHECK_EQ(14, foo->GetScriptColumnNumber()); | 17535 CHECK_EQ(14, foo->GetScriptColumnNumber()); |
17536 CHECK_EQ(17, bar->GetScriptColumnNumber()); | 17536 CHECK_EQ(17, bar->GetScriptColumnNumber()); |
17537 } | 17537 } |
17538 | 17538 |
17539 | 17539 |
| 17540 THREADED_TEST(FunctionIsBuiltin) { |
| 17541 LocalContext env; |
| 17542 v8::HandleScope scope(env->GetIsolate()); |
| 17543 v8::Local<v8::Function> f; |
| 17544 f = v8::Local<v8::Function>::Cast(CompileRun("Math.floor")); |
| 17545 CHECK(f->IsBuiltin()); |
| 17546 f = v8::Local<v8::Function>::Cast(CompileRun("Object")); |
| 17547 CHECK(f->IsBuiltin()); |
| 17548 f = v8::Local<v8::Function>::Cast(CompileRun("Object.__defineSetter__")); |
| 17549 CHECK(f->IsBuiltin()); |
| 17550 f = v8::Local<v8::Function>::Cast(CompileRun("Array.prototype.toString")); |
| 17551 CHECK(f->IsBuiltin()); |
| 17552 f = v8::Local<v8::Function>::Cast(CompileRun("function a() {}; a;")); |
| 17553 CHECK(!f->IsBuiltin()); |
| 17554 } |
| 17555 |
| 17556 |
17540 THREADED_TEST(FunctionGetScriptId) { | 17557 THREADED_TEST(FunctionGetScriptId) { |
17541 LocalContext env; | 17558 LocalContext env; |
17542 v8::HandleScope scope(env->GetIsolate()); | 17559 v8::HandleScope scope(env->GetIsolate()); |
17543 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"), | 17560 v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"), |
17544 v8::Integer::New(3), v8::Integer::New(2)); | 17561 v8::Integer::New(3), v8::Integer::New(2)); |
17545 v8::Handle<v8::String> scriptSource = v8::String::New( | 17562 v8::Handle<v8::String> scriptSource = v8::String::New( |
17546 "function foo() {}\n\n function bar() {}"); | 17563 "function foo() {}\n\n function bar() {}"); |
17547 v8::Local<v8::Script> script(v8::Script::Compile(scriptSource, &origin)); | 17564 v8::Local<v8::Script> script(v8::Script::Compile(scriptSource, &origin)); |
17548 script->Run(); | 17565 script->Run(); |
17549 v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast( | 17566 v8::Local<v8::Function> foo = v8::Local<v8::Function>::Cast( |
(...skipping 3080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20630 } | 20647 } |
20631 for (int i = 0; i < runs; i++) { | 20648 for (int i = 0; i < runs; i++) { |
20632 Local<String> expected; | 20649 Local<String> expected; |
20633 if (i != 0) { | 20650 if (i != 0) { |
20634 CHECK_EQ(v8_str("escape value"), values[i]); | 20651 CHECK_EQ(v8_str("escape value"), values[i]); |
20635 } else { | 20652 } else { |
20636 CHECK(values[i].IsEmpty()); | 20653 CHECK(values[i].IsEmpty()); |
20637 } | 20654 } |
20638 } | 20655 } |
20639 } | 20656 } |
OLD | NEW |