| 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 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 LocalContext env(NULL, global_template); | 2428 LocalContext env(NULL, global_template); |
| 2429 v8::Handle<v8::Object> global_proxy = env->Global(); | 2429 v8::Handle<v8::Object> global_proxy = env->Global(); |
| 2430 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); | 2430 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); |
| 2431 CHECK_EQ(1, global->InternalFieldCount()); | 2431 CHECK_EQ(1, global->InternalFieldCount()); |
| 2432 CHECK(global->GetInternalField(0)->IsUndefined()); | 2432 CHECK(global->GetInternalField(0)->IsUndefined()); |
| 2433 global->SetInternalField(0, v8_num(17)); | 2433 global->SetInternalField(0, v8_num(17)); |
| 2434 CHECK_EQ(17, global->GetInternalField(0)->Int32Value()); | 2434 CHECK_EQ(17, global->GetInternalField(0)->Int32Value()); |
| 2435 } | 2435 } |
| 2436 | 2436 |
| 2437 | 2437 |
| 2438 THREADED_TEST(GlobalObjectHasRealIndexedProperty) { |
| 2439 LocalContext env; |
| 2440 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 2441 |
| 2442 v8::Local<v8::Object> global = env->Global(); |
| 2443 global->Set(0, v8::String::New("value")); |
| 2444 CHECK(global->HasRealIndexedProperty(0)); |
| 2445 } |
| 2446 |
| 2447 |
| 2438 static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj, | 2448 static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj, |
| 2439 void* value) { | 2449 void* value) { |
| 2440 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1)); | 2450 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1)); |
| 2441 obj->SetAlignedPointerInInternalField(0, value); | 2451 obj->SetAlignedPointerInInternalField(0, value); |
| 2442 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 2452 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 2443 CHECK_EQ(value, obj->GetAlignedPointerFromInternalField(0)); | 2453 CHECK_EQ(value, obj->GetAlignedPointerFromInternalField(0)); |
| 2444 } | 2454 } |
| 2445 | 2455 |
| 2446 | 2456 |
| 2447 THREADED_TEST(InternalFieldsAlignedPointers) { | 2457 THREADED_TEST(InternalFieldsAlignedPointers) { |
| (...skipping 17087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19535 context1->Global()->Set(v8_str("array"), array); | 19545 context1->Global()->Set(v8_str("array"), array); |
| 19536 ExpectString("JSON.stringify(array)", "[\"a\",\"b\"]"); | 19546 ExpectString("JSON.stringify(array)", "[\"a\",\"b\"]"); |
| 19537 array->TurnOnAccessCheck(); | 19547 array->TurnOnAccessCheck(); |
| 19538 ExpectString("JSON.stringify(array)", "[]"); | 19548 ExpectString("JSON.stringify(array)", "[]"); |
| 19539 ExpectString("JSON.stringify([array])", "[[]]"); | 19549 ExpectString("JSON.stringify([array])", "[[]]"); |
| 19540 ExpectString("JSON.stringify({'a' : array})", "{\"a\":[]}"); | 19550 ExpectString("JSON.stringify({'a' : array})", "{\"a\":[]}"); |
| 19541 } | 19551 } |
| 19542 } | 19552 } |
| 19543 | 19553 |
| 19544 #endif // WIN32 | 19554 #endif // WIN32 |
| OLD | NEW |