| 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 2585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 i::FLAG_harmony_array_buffer = true; | 2596 i::FLAG_harmony_array_buffer = true; |
| 2597 i::FLAG_harmony_typed_arrays = true; | 2597 i::FLAG_harmony_typed_arrays = true; |
| 2598 | 2598 |
| 2599 LocalContext env; | 2599 LocalContext env; |
| 2600 v8::Isolate* isolate = env->GetIsolate(); | 2600 v8::Isolate* isolate = env->GetIsolate(); |
| 2601 v8::HandleScope handle_scope(isolate); | 2601 v8::HandleScope handle_scope(isolate); |
| 2602 | 2602 |
| 2603 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(1024); | 2603 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(1024); |
| 2604 CheckInternalFieldsAreZero(ab); | 2604 CheckInternalFieldsAreZero(ab); |
| 2605 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); | 2605 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); |
| 2606 CHECK_NE(0, ab->BaseAddress()); |
| 2606 CHECK(!ab->IsExternal()); | 2607 CHECK(!ab->IsExternal()); |
| 2607 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 2608 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 2608 | 2609 |
| 2609 ScopedArrayBufferContents ab_contents(ab->Externalize()); | 2610 ScopedArrayBufferContents ab_contents(ab->Externalize()); |
| 2610 CHECK(ab->IsExternal()); | 2611 CHECK(ab->IsExternal()); |
| 2611 | 2612 |
| 2612 CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength())); | 2613 CHECK_EQ(1024, static_cast<int>(ab_contents.ByteLength())); |
| 2613 uint8_t* data = static_cast<uint8_t*>(ab_contents.Data()); | 2614 uint8_t* data = static_cast<uint8_t*>(ab_contents.Data()); |
| 2614 ASSERT(data != NULL); | 2615 ASSERT(data != NULL); |
| 2616 CHECK_EQ(data, ab->BaseAddress()); |
| 2615 env->Global()->Set(v8_str("ab"), ab); | 2617 env->Global()->Set(v8_str("ab"), ab); |
| 2616 | 2618 |
| 2617 v8::Handle<v8::Value> result = CompileRun("ab.byteLength"); | 2619 v8::Handle<v8::Value> result = CompileRun("ab.byteLength"); |
| 2618 CHECK_EQ(1024, result->Int32Value()); | 2620 CHECK_EQ(1024, result->Int32Value()); |
| 2619 | 2621 |
| 2620 result = CompileRun("var u8 = new Uint8Array(ab);" | 2622 result = CompileRun("var u8 = new Uint8Array(ab);" |
| 2621 "u8[0] = 0xFF;" | 2623 "u8[0] = 0xFF;" |
| 2622 "u8[1] = 0xAA;" | 2624 "u8[1] = 0xAA;" |
| 2623 "u8.length"); | 2625 "u8.length"); |
| 2624 CHECK_EQ(1024, result->Int32Value()); | 2626 CHECK_EQ(1024, result->Int32Value()); |
| (...skipping 17272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19897 CheckCorrectThrow("%HasProperty(other, 'x')"); | 19899 CheckCorrectThrow("%HasProperty(other, 'x')"); |
| 19898 CheckCorrectThrow("%HasElement(other, 1)"); | 19900 CheckCorrectThrow("%HasElement(other, 1)"); |
| 19899 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); | 19901 CheckCorrectThrow("%IsPropertyEnumerable(other, 'x')"); |
| 19900 CheckCorrectThrow("%GetPropertyNames(other)"); | 19902 CheckCorrectThrow("%GetPropertyNames(other)"); |
| 19901 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); | 19903 CheckCorrectThrow("%GetLocalPropertyNames(other, true)"); |
| 19902 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" | 19904 CheckCorrectThrow("%DefineOrRedefineAccessorProperty(" |
| 19903 "other, 'x', null, null, 1)"); | 19905 "other, 'x', null, null, 1)"); |
| 19904 } | 19906 } |
| 19905 | 19907 |
| 19906 #endif // WIN32 | 19908 #endif // WIN32 |
| OLD | NEW |