| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 value = CompileRun("accessible['y'];"); | 140 value = CompileRun("accessible['y'];"); |
| 141 CHECK_EQ(expected_value, value); | 141 CHECK_EQ(expected_value, value); |
| 142 value = CompileRun("accessible[13];"); | 142 value = CompileRun("accessible[13];"); |
| 143 CHECK_EQ(expected_value, value); | 143 CHECK_EQ(expected_value, value); |
| 144 value = CompileRun("accessible['13'];"); | 144 value = CompileRun("accessible['13'];"); |
| 145 CHECK_EQ(expected_value, value); | 145 CHECK_EQ(expected_value, value); |
| 146 } | 146 } |
| 147 | 147 |
| 148 | 148 |
| 149 static v8::Handle<v8::Value> Convert(int32_t value, v8::Isolate* isolate) { | 149 static v8::Handle<v8::Value> Convert(int32_t value, v8::Isolate* isolate) { |
| 150 return v8::Integer::New(isolate, value); | 150 return v8::Integer::New(value, isolate); |
| 151 } | 151 } |
| 152 | 152 |
| 153 | 153 |
| 154 static v8::Handle<v8::Value> Convert(float value, v8::Isolate* isolate) { | 154 static v8::Handle<v8::Value> Convert(float value, v8::Isolate*) { |
| 155 return v8::Number::New(isolate, value); | 155 return v8::Number::New(value); |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 static v8::Handle<v8::Value> Convert(double value, v8::Isolate* isolate) { | 159 static v8::Handle<v8::Value> Convert(double value, v8::Isolate*) { |
| 160 return v8::Number::New(isolate, value); | 160 return v8::Number::New(value); |
| 161 } | 161 } |
| 162 | 162 |
| 163 | 163 |
| 164 typedef v8::ObjectOperationDescriptor OOD; | 164 typedef v8::ObjectOperationDescriptor OOD; |
| 165 | 165 |
| 166 template<typename T> | 166 template<typename T> |
| 167 static void TestPrimitiveValue( | 167 static void TestPrimitiveValue( |
| 168 T value, | 168 T value, |
| 169 v8::DeclaredAccessorDescriptorDataType data_type, | 169 v8::DeclaredAccessorDescriptorDataType data_type, |
| 170 DescriptorTestHelper* helper) { | 170 DescriptorTestHelper* helper) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 v8::Handle<v8::DeclaredAccessorDescriptor> descriptor = | 270 v8::Handle<v8::DeclaredAccessorDescriptor> descriptor = |
| 271 OOD::NewInternalFieldDereference(helper.isolate_, internal_field) | 271 OOD::NewInternalFieldDereference(helper.isolate_, internal_field) |
| 272 ->NewRawShift(helper.isolate_, first_index*kPointerSize) | 272 ->NewRawShift(helper.isolate_, first_index*kPointerSize) |
| 273 ->NewRawDereference(helper.isolate_) | 273 ->NewRawDereference(helper.isolate_) |
| 274 ->NewRawShift(helper.isolate_, | 274 ->NewRawShift(helper.isolate_, |
| 275 static_cast<uint16_t>(second_index*sizeof(int16_t))) | 275 static_cast<uint16_t>(second_index*sizeof(int16_t))) |
| 276 ->NewPrimitiveValue(helper.isolate_, v8::kDescriptorInt16Type, 0); | 276 ->NewPrimitiveValue(helper.isolate_, v8::kDescriptorInt16Type, 0); |
| 277 AlignedArray* array = helper.array_.get(); | 277 AlignedArray* array = helper.array_.get(); |
| 278 array->As<uintptr_t**>()[first_index] = | 278 array->As<uintptr_t**>()[first_index] = |
| 279 &array->As<uintptr_t*>()[pointed_to_index]; | 279 &array->As<uintptr_t*>()[pointed_to_index]; |
| 280 VerifyRead(descriptor, internal_field, array, | 280 VerifyRead(descriptor, internal_field, array, v8::Integer::New(0)); |
| 281 v8::Integer::New(helper.isolate_, 0)); | |
| 282 second_index += pointed_to_index*sizeof(uintptr_t)/sizeof(uint16_t); | 281 second_index += pointed_to_index*sizeof(uintptr_t)/sizeof(uint16_t); |
| 283 array->As<uint16_t*>()[second_index] = expected; | 282 array->As<uint16_t*>()[second_index] = expected; |
| 284 VerifyRead(descriptor, internal_field, array, | 283 VerifyRead(descriptor, internal_field, array, v8::Integer::New(expected)); |
| 285 v8::Integer::New(helper.isolate_, expected)); | |
| 286 } | 284 } |
| 287 | 285 |
| 288 | 286 |
| 289 TEST(HandleDereferenceRead) { | 287 TEST(HandleDereferenceRead) { |
| 290 DescriptorTestHelper helper; | 288 DescriptorTestHelper helper; |
| 291 v8::HandleScope handle_scope(helper.isolate_); | 289 v8::HandleScope handle_scope(helper.isolate_); |
| 292 int index = 13; | 290 int index = 13; |
| 293 int internal_field = 0; | 291 int internal_field = 0; |
| 294 v8::Handle<v8::DeclaredAccessorDescriptor> descriptor = | 292 v8::Handle<v8::DeclaredAccessorDescriptor> descriptor = |
| 295 OOD::NewInternalFieldDereference(helper.isolate_, internal_field) | 293 OOD::NewInternalFieldDereference(helper.isolate_, internal_field) |
| 296 ->NewRawShift(helper.isolate_, index*kPointerSize) | 294 ->NewRawShift(helper.isolate_, index*kPointerSize) |
| 297 ->NewHandleDereference(helper.isolate_); | 295 ->NewHandleDereference(helper.isolate_); |
| 298 HandleArray* array = helper.handle_array_.get(); | 296 HandleArray* array = helper.handle_array_.get(); |
| 299 v8::Handle<v8::String> expected = v8_str("whatever"); | 297 v8::Handle<v8::String> expected = v8_str("whatever"); |
| 300 array->handles_[index].Reset(helper.isolate_, expected); | 298 array->handles_[index].Reset(helper.isolate_, expected); |
| 301 VerifyRead(descriptor, internal_field, array, expected); | 299 VerifyRead(descriptor, internal_field, array, expected); |
| 302 } | 300 } |
| OLD | NEW |