Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: src/api.cc

Issue 6260011: Port r6388 to 2.4 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.4/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3198 "Writing internal field out of bounds")) { 3198 "Writing internal field out of bounds")) {
3199 return; 3199 return;
3200 } 3200 }
3201 ENTER_V8; 3201 ENTER_V8;
3202 i::Handle<i::Object> val = Utils::OpenHandle(*value); 3202 i::Handle<i::Object> val = Utils::OpenHandle(*value);
3203 obj->SetInternalField(index, *val); 3203 obj->SetInternalField(index, *val);
3204 } 3204 }
3205 3205
3206 3206
3207 static bool CanBeEncodedAsSmi(void* ptr) { 3207 static bool CanBeEncodedAsSmi(void* ptr) {
3208 const intptr_t address = reinterpret_cast<intptr_t>(ptr); 3208 const uintptr_t address = reinterpret_cast<uintptr_t>(ptr);
3209 return ((address & i::kEncodablePointerMask) == 0); 3209 return ((address & i::kEncodablePointerMask) == 0);
3210 } 3210 }
3211 3211
3212 3212
3213 static i::Smi* EncodeAsSmi(void* ptr) { 3213 static i::Smi* EncodeAsSmi(void* ptr) {
3214 ASSERT(CanBeEncodedAsSmi(ptr)); 3214 ASSERT(CanBeEncodedAsSmi(ptr));
3215 const intptr_t address = reinterpret_cast<intptr_t>(ptr); 3215 const uintptr_t address = reinterpret_cast<uintptr_t>(ptr);
3216 i::Smi* result = reinterpret_cast<i::Smi*>(address << i::kPointerToSmiShift); 3216 i::Smi* result = reinterpret_cast<i::Smi*>(address << i::kPointerToSmiShift);
3217 ASSERT(i::Internals::HasSmiTag(result)); 3217 ASSERT(i::Internals::HasSmiTag(result));
3218 ASSERT_EQ(result, i::Smi::FromInt(result->value())); 3218 ASSERT_EQ(result, i::Smi::FromInt(result->value()));
3219 ASSERT_EQ(ptr, i::Internals::GetExternalPointerFromSmi(result)); 3219 ASSERT_EQ(ptr, i::Internals::GetExternalPointerFromSmi(result));
3220 return result; 3220 return result;
3221 } 3221 }
3222 3222
3223 3223
3224 void v8::Object::SetPointerInInternalField(int index, void* value) { 3224 void v8::Object::SetPointerInInternalField(int index, void* value) {
3225 ENTER_V8; 3225 ENTER_V8;
(...skipping 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after
4987 4987
4988 4988
4989 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 4989 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
4990 HandleScopeImplementer* thread_local = 4990 HandleScopeImplementer* thread_local =
4991 reinterpret_cast<HandleScopeImplementer*>(storage); 4991 reinterpret_cast<HandleScopeImplementer*>(storage);
4992 thread_local->IterateThis(v); 4992 thread_local->IterateThis(v);
4993 return storage + ArchiveSpacePerThread(); 4993 return storage + ArchiveSpacePerThread();
4994 } 4994 }
4995 4995
4996 } } // namespace v8::internal 4996 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698