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 18524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18535 ->Run(env.local()) | 18535 ->Run(env.local()) |
18536 .ToLocalChecked(); | 18536 .ToLocalChecked(); |
18537 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( | 18537 v8::Local<v8::Function> f = v8::Local<v8::Function>::Cast( |
18538 env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked()); | 18538 env->Global()->Get(env.local(), v8_str("f")).ToLocalChecked()); |
18539 CHECK_EQ(0, | 18539 CHECK_EQ(0, |
18540 strcmp("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName()))); | 18540 strcmp("foo.bar.baz", *v8::String::Utf8Value(f->GetInferredName()))); |
18541 } | 18541 } |
18542 | 18542 |
18543 | 18543 |
18544 THREADED_TEST(FunctionGetDebugName) { | 18544 THREADED_TEST(FunctionGetDebugName) { |
18545 i::FLAG_harmony_function_name = true; | |
18546 LocalContext env; | 18545 LocalContext env; |
18547 v8::HandleScope scope(env->GetIsolate()); | 18546 v8::HandleScope scope(env->GetIsolate()); |
18548 const char* code = | 18547 const char* code = |
18549 "var error = false;" | 18548 "var error = false;" |
18550 "function a() { this.x = 1; };" | 18549 "function a() { this.x = 1; };" |
18551 "a.displayName = 'display_a';" | 18550 "a.displayName = 'display_a';" |
18552 "var b = (function() {" | 18551 "var b = (function() {" |
18553 " var f = function() { this.x = 2; };" | 18552 " var f = function() { this.x = 2; };" |
18554 " f.displayName = 'display_b';" | 18553 " f.displayName = 'display_b';" |
18555 " return f;" | 18554 " return f;" |
(...skipping 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20070 Visitor42 visitor(&object2); | 20069 Visitor42 visitor(&object2); |
20071 isolate->VisitHandlesForPartialDependence(&visitor); | 20070 isolate->VisitHandlesForPartialDependence(&visitor); |
20072 CHECK_EQ(1, visitor.counter_); | 20071 CHECK_EQ(1, visitor.counter_); |
20073 | 20072 |
20074 object1.Reset(); | 20073 object1.Reset(); |
20075 object2.Reset(); | 20074 object2.Reset(); |
20076 } | 20075 } |
20077 | 20076 |
20078 | 20077 |
20079 TEST(RegExp) { | 20078 TEST(RegExp) { |
20080 i::FLAG_harmony_unicode_regexps = true; | |
20081 LocalContext context; | 20079 LocalContext context; |
20082 v8::HandleScope scope(context->GetIsolate()); | 20080 v8::HandleScope scope(context->GetIsolate()); |
20083 | 20081 |
20084 v8::Local<v8::RegExp> re = | 20082 v8::Local<v8::RegExp> re = |
20085 v8::RegExp::New(context.local(), v8_str("foo"), v8::RegExp::kNone) | 20083 v8::RegExp::New(context.local(), v8_str("foo"), v8::RegExp::kNone) |
20086 .ToLocalChecked(); | 20084 .ToLocalChecked(); |
20087 CHECK(re->IsRegExp()); | 20085 CHECK(re->IsRegExp()); |
20088 CHECK(re->GetSource()->Equals(context.local(), v8_str("foo")).FromJust()); | 20086 CHECK(re->GetSource()->Equals(context.local(), v8_str("foo")).FromJust()); |
20089 CHECK_EQ(v8::RegExp::kNone, re->GetFlags()); | 20087 CHECK_EQ(v8::RegExp::kNone, re->GetFlags()); |
20090 | 20088 |
(...skipping 5252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
25343 } | 25341 } |
25344 | 25342 |
25345 TEST(PrivateForApiIsNumber) { | 25343 TEST(PrivateForApiIsNumber) { |
25346 LocalContext context; | 25344 LocalContext context; |
25347 v8::Isolate* isolate = CcTest::isolate(); | 25345 v8::Isolate* isolate = CcTest::isolate(); |
25348 v8::HandleScope scope(isolate); | 25346 v8::HandleScope scope(isolate); |
25349 | 25347 |
25350 // Shouldn't crash. | 25348 // Shouldn't crash. |
25351 v8::Private::ForApi(isolate, v8_str("42")); | 25349 v8::Private::ForApi(isolate, v8_str("42")); |
25352 } | 25350 } |
OLD | NEW |