OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3260 "Writing internal field out of bounds")) { | 3260 "Writing internal field out of bounds")) { |
3261 return; | 3261 return; |
3262 } | 3262 } |
3263 ENTER_V8; | 3263 ENTER_V8; |
3264 i::Handle<i::Object> val = Utils::OpenHandle(*value); | 3264 i::Handle<i::Object> val = Utils::OpenHandle(*value); |
3265 obj->SetInternalField(index, *val); | 3265 obj->SetInternalField(index, *val); |
3266 } | 3266 } |
3267 | 3267 |
3268 | 3268 |
3269 static bool CanBeEncodedAsSmi(void* ptr) { | 3269 static bool CanBeEncodedAsSmi(void* ptr) { |
3270 const intptr_t address = reinterpret_cast<intptr_t>(ptr); | 3270 const uintptr_t address = reinterpret_cast<uintptr_t>(ptr); |
3271 return ((address & i::kEncodablePointerMask) == 0); | 3271 return ((address & i::kEncodablePointerMask) == 0); |
3272 } | 3272 } |
3273 | 3273 |
3274 | 3274 |
3275 static i::Smi* EncodeAsSmi(void* ptr) { | 3275 static i::Smi* EncodeAsSmi(void* ptr) { |
3276 ASSERT(CanBeEncodedAsSmi(ptr)); | 3276 ASSERT(CanBeEncodedAsSmi(ptr)); |
3277 const intptr_t address = reinterpret_cast<intptr_t>(ptr); | 3277 const uintptr_t address = reinterpret_cast<uintptr_t>(ptr); |
3278 i::Smi* result = reinterpret_cast<i::Smi*>(address << i::kPointerToSmiShift); | 3278 i::Smi* result = reinterpret_cast<i::Smi*>(address << i::kPointerToSmiShift); |
3279 ASSERT(i::Internals::HasSmiTag(result)); | 3279 ASSERT(i::Internals::HasSmiTag(result)); |
3280 ASSERT_EQ(result, i::Smi::FromInt(result->value())); | 3280 ASSERT_EQ(result, i::Smi::FromInt(result->value())); |
3281 ASSERT_EQ(ptr, i::Internals::GetExternalPointerFromSmi(result)); | 3281 ASSERT_EQ(ptr, i::Internals::GetExternalPointerFromSmi(result)); |
3282 return result; | 3282 return result; |
3283 } | 3283 } |
3284 | 3284 |
3285 | 3285 |
3286 void v8::Object::SetPointerInInternalField(int index, void* value) { | 3286 void v8::Object::SetPointerInInternalField(int index, void* value) { |
3287 ENTER_V8; | 3287 ENTER_V8; |
(...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5156 | 5156 |
5157 | 5157 |
5158 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 5158 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
5159 HandleScopeImplementer* thread_local = | 5159 HandleScopeImplementer* thread_local = |
5160 reinterpret_cast<HandleScopeImplementer*>(storage); | 5160 reinterpret_cast<HandleScopeImplementer*>(storage); |
5161 thread_local->IterateThis(v); | 5161 thread_local->IterateThis(v); |
5162 return storage + ArchiveSpacePerThread(); | 5162 return storage + ArchiveSpacePerThread(); |
5163 } | 5163 } |
5164 | 5164 |
5165 } } // namespace v8::internal | 5165 } } // namespace v8::internal |
OLD | NEW |