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

Side by Side Diff: src/api.cc

Issue 6311009: Port r6388 to 2.5 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/2.5/
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 3226 matching lines...) Expand 10 before | Expand all | Expand 10 after
3237 "Writing internal field out of bounds")) { 3237 "Writing internal field out of bounds")) {
3238 return; 3238 return;
3239 } 3239 }
3240 ENTER_V8; 3240 ENTER_V8;
3241 i::Handle<i::Object> val = Utils::OpenHandle(*value); 3241 i::Handle<i::Object> val = Utils::OpenHandle(*value);
3242 obj->SetInternalField(index, *val); 3242 obj->SetInternalField(index, *val);
3243 } 3243 }
3244 3244
3245 3245
3246 static bool CanBeEncodedAsSmi(void* ptr) { 3246 static bool CanBeEncodedAsSmi(void* ptr) {
3247 const intptr_t address = reinterpret_cast<intptr_t>(ptr); 3247 const uintptr_t address = reinterpret_cast<uintptr_t>(ptr);
3248 return ((address & i::kEncodablePointerMask) == 0); 3248 return ((address & i::kEncodablePointerMask) == 0);
3249 } 3249 }
3250 3250
3251 3251
3252 static i::Smi* EncodeAsSmi(void* ptr) { 3252 static i::Smi* EncodeAsSmi(void* ptr) {
3253 ASSERT(CanBeEncodedAsSmi(ptr)); 3253 ASSERT(CanBeEncodedAsSmi(ptr));
3254 const intptr_t address = reinterpret_cast<intptr_t>(ptr); 3254 const uintptr_t address = reinterpret_cast<uintptr_t>(ptr);
3255 i::Smi* result = reinterpret_cast<i::Smi*>(address << i::kPointerToSmiShift); 3255 i::Smi* result = reinterpret_cast<i::Smi*>(address << i::kPointerToSmiShift);
3256 ASSERT(i::Internals::HasSmiTag(result)); 3256 ASSERT(i::Internals::HasSmiTag(result));
3257 ASSERT_EQ(result, i::Smi::FromInt(result->value())); 3257 ASSERT_EQ(result, i::Smi::FromInt(result->value()));
3258 ASSERT_EQ(ptr, i::Internals::GetExternalPointerFromSmi(result)); 3258 ASSERT_EQ(ptr, i::Internals::GetExternalPointerFromSmi(result));
3259 return result; 3259 return result;
3260 } 3260 }
3261 3261
3262 3262
3263 void v8::Object::SetPointerInInternalField(int index, void* value) { 3263 void v8::Object::SetPointerInInternalField(int index, void* value) {
3264 ENTER_V8; 3264 ENTER_V8;
(...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after
5032 5032
5033 5033
5034 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5034 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5035 HandleScopeImplementer* thread_local = 5035 HandleScopeImplementer* thread_local =
5036 reinterpret_cast<HandleScopeImplementer*>(storage); 5036 reinterpret_cast<HandleScopeImplementer*>(storage);
5037 thread_local->IterateThis(v); 5037 thread_local->IterateThis(v);
5038 return storage + ArchiveSpacePerThread(); 5038 return storage + ArchiveSpacePerThread();
5039 } 5039 }
5040 5040
5041 } } // namespace v8::internal 5041 } } // 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