| 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 2806 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2817   CheckEmbedderData( | 2817   CheckEmbedderData( | 
| 2818       &env, 3, | 2818       &env, 3, | 
| 2819       v8::String::NewFromUtf8(isolate, "The quick brown fox jumps")); | 2819       v8::String::NewFromUtf8(isolate, "The quick brown fox jumps")); | 
| 2820   CheckEmbedderData(&env, 2, v8::String::NewFromUtf8(isolate, | 2820   CheckEmbedderData(&env, 2, v8::String::NewFromUtf8(isolate, | 
| 2821                                                      "over the lazy dog.")); | 2821                                                      "over the lazy dog.")); | 
| 2822   CheckEmbedderData(&env, 1, v8::Number::New(isolate, 1.2345)); | 2822   CheckEmbedderData(&env, 1, v8::Number::New(isolate, 1.2345)); | 
| 2823   CheckEmbedderData(&env, 0, v8::Boolean::New(isolate, true)); | 2823   CheckEmbedderData(&env, 0, v8::Boolean::New(isolate, true)); | 
| 2824 } | 2824 } | 
| 2825 | 2825 | 
| 2826 | 2826 | 
|  | 2827 THREADED_TEST(GetIsolate) { | 
|  | 2828   LocalContext env; | 
|  | 2829   v8::Isolate* isolate = env->GetIsolate(); | 
|  | 2830   v8::HandleScope scope(isolate); | 
|  | 2831   Local<v8::Object> obj = v8::Object::New(isolate); | 
|  | 2832   CHECK_EQ(isolate, obj->GetIsolate()); | 
|  | 2833   CHECK_EQ(isolate, CcTest::global()->GetIsolate()); | 
|  | 2834 } | 
|  | 2835 | 
|  | 2836 | 
| 2827 THREADED_TEST(IdentityHash) { | 2837 THREADED_TEST(IdentityHash) { | 
| 2828   LocalContext env; | 2838   LocalContext env; | 
| 2829   v8::Isolate* isolate = env->GetIsolate(); | 2839   v8::Isolate* isolate = env->GetIsolate(); | 
| 2830   v8::HandleScope scope(isolate); | 2840   v8::HandleScope scope(isolate); | 
| 2831 | 2841 | 
| 2832   // Ensure that the test starts with an fresh heap to test whether the hash | 2842   // Ensure that the test starts with an fresh heap to test whether the hash | 
| 2833   // code is based on the address. | 2843   // code is based on the address. | 
| 2834   CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 2844   CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags); | 
| 2835   Local<v8::Object> obj = v8::Object::New(isolate); | 2845   Local<v8::Object> obj = v8::Object::New(isolate); | 
| 2836   int hash = obj->GetIdentityHash(); | 2846   int hash = obj->GetIdentityHash(); | 
| (...skipping 20104 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 22941   LocalContext context; | 22951   LocalContext context; | 
| 22942   v8::Isolate* isolate = context->GetIsolate(); | 22952   v8::Isolate* isolate = context->GetIsolate(); | 
| 22943   v8::HandleScope scope(isolate); | 22953   v8::HandleScope scope(isolate); | 
| 22944   Handle<Object> global = context->Global(); | 22954   Handle<Object> global = context->Global(); | 
| 22945 | 22955 | 
| 22946   // Creation. | 22956   // Creation. | 
| 22947   Handle<v8::Promise::Resolver> pr = v8::Promise::Resolver::New(isolate); | 22957   Handle<v8::Promise::Resolver> pr = v8::Promise::Resolver::New(isolate); | 
| 22948   Handle<v8::Promise::Resolver> rr = v8::Promise::Resolver::New(isolate); | 22958   Handle<v8::Promise::Resolver> rr = v8::Promise::Resolver::New(isolate); | 
| 22949   Handle<v8::Promise> p = pr->GetPromise(); | 22959   Handle<v8::Promise> p = pr->GetPromise(); | 
| 22950   Handle<v8::Promise> r = rr->GetPromise(); | 22960   Handle<v8::Promise> r = rr->GetPromise(); | 
|  | 22961   CHECK_EQ(isolate, p->GetIsolate()); | 
| 22951 | 22962 | 
| 22952   // IsPromise predicate. | 22963   // IsPromise predicate. | 
| 22953   CHECK(p->IsPromise()); | 22964   CHECK(p->IsPromise()); | 
| 22954   CHECK(r->IsPromise()); | 22965   CHECK(r->IsPromise()); | 
| 22955   Handle<Value> o = v8::Object::New(isolate); | 22966   Handle<Value> o = v8::Object::New(isolate); | 
| 22956   CHECK(!o->IsPromise()); | 22967   CHECK(!o->IsPromise()); | 
| 22957 | 22968 | 
| 22958   // Resolution and rejection. | 22969   // Resolution and rejection. | 
| 22959   pr->Resolve(v8::Integer::New(isolate, 1)); | 22970   pr->Resolve(v8::Integer::New(isolate, 1)); | 
| 22960   CHECK(p->IsPromise()); | 22971   CHECK(p->IsPromise()); | 
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 23689       "  var foobXXXXX";  // Too many bytes which look like incomplete chars! | 23700       "  var foobXXXXX";  // Too many bytes which look like incomplete chars! | 
| 23690   char chunk2[] = | 23701   char chunk2[] = | 
| 23691       "r = 13;\n" | 23702       "r = 13;\n" | 
| 23692       "  return foob\xeb\x91\x80\x80\x80r;\n" | 23703       "  return foob\xeb\x91\x80\x80\x80r;\n" | 
| 23693       "}\n"; | 23704       "}\n"; | 
| 23694   for (int i = 0; i < 5; ++i) chunk1[strlen(chunk1) - 5 + i] = reference[i]; | 23705   for (int i = 0; i < 5; ++i) chunk1[strlen(chunk1) - 5 + i] = reference[i]; | 
| 23695 | 23706 | 
| 23696   const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; | 23707   const char* chunks[] = {chunk1, chunk2, "foo();", NULL}; | 
| 23697   RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, false); | 23708   RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, false); | 
| 23698 } | 23709 } | 
| OLD | NEW | 
|---|