| 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 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2027 LocalContext env(NULL, global_template); | 2027 LocalContext env(NULL, global_template); |
| 2028 v8::Handle<v8::Object> global_proxy = env->Global(); | 2028 v8::Handle<v8::Object> global_proxy = env->Global(); |
| 2029 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); | 2029 v8::Handle<v8::Object> global = global_proxy->GetPrototype().As<v8::Object>(); |
| 2030 CHECK_EQ(1, global->InternalFieldCount()); | 2030 CHECK_EQ(1, global->InternalFieldCount()); |
| 2031 CHECK(global->GetInternalField(0)->IsUndefined()); | 2031 CHECK(global->GetInternalField(0)->IsUndefined()); |
| 2032 global->SetInternalField(0, v8_num(17)); | 2032 global->SetInternalField(0, v8_num(17)); |
| 2033 CHECK_EQ(17, global->GetInternalField(0)->Int32Value()); | 2033 CHECK_EQ(17, global->GetInternalField(0)->Int32Value()); |
| 2034 } | 2034 } |
| 2035 | 2035 |
| 2036 | 2036 |
| 2037 THREADED_TEST(GlobalObjectHasRealIndexedProperty) { |
| 2038 LocalContext env; |
| 2039 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 2040 |
| 2041 v8::Local<v8::Object> global = env->Global(); |
| 2042 global->Set(0, v8::String::New("value")); |
| 2043 CHECK(global->HasRealIndexedProperty(0)); |
| 2044 } |
| 2045 |
| 2046 |
| 2037 static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj, | 2047 static void CheckAlignedPointerInInternalField(Handle<v8::Object> obj, |
| 2038 void* value) { | 2048 void* value) { |
| 2039 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1)); | 2049 CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1)); |
| 2040 obj->SetAlignedPointerInInternalField(0, value); | 2050 obj->SetAlignedPointerInInternalField(0, value); |
| 2041 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 2051 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 2042 CHECK_EQ(value, obj->GetAlignedPointerFromInternalField(0)); | 2052 CHECK_EQ(value, obj->GetAlignedPointerFromInternalField(0)); |
| 2043 } | 2053 } |
| 2044 | 2054 |
| 2045 | 2055 |
| 2046 THREADED_TEST(InternalFieldsAlignedPointers) { | 2056 THREADED_TEST(InternalFieldsAlignedPointers) { |
| (...skipping 16894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18941 context1->Global()->Set(v8_str("array"), array); | 18951 context1->Global()->Set(v8_str("array"), array); |
| 18942 ExpectString("JSON.stringify(array)", "[\"a\",\"b\"]"); | 18952 ExpectString("JSON.stringify(array)", "[\"a\",\"b\"]"); |
| 18943 array->TurnOnAccessCheck(); | 18953 array->TurnOnAccessCheck(); |
| 18944 ExpectString("JSON.stringify(array)", "[]"); | 18954 ExpectString("JSON.stringify(array)", "[]"); |
| 18945 ExpectString("JSON.stringify([array])", "[[]]"); | 18955 ExpectString("JSON.stringify([array])", "[[]]"); |
| 18946 ExpectString("JSON.stringify({'a' : array})", "{\"a\":[]}"); | 18956 ExpectString("JSON.stringify({'a' : array})", "{\"a\":[]}"); |
| 18947 } | 18957 } |
| 18948 } | 18958 } |
| 18949 | 18959 |
| 18950 #endif // WIN32 | 18960 #endif // WIN32 |
| OLD | NEW |