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

Side by Side Diff: src/handles.h

Issue 225283005: Return MaybeHandle from SetProperty. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 8 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 | « src/factory.cc ('k') | src/handles.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 template <class S> MaybeHandle(MaybeHandle<S> maybe_handle) { 61 template <class S> MaybeHandle(MaybeHandle<S> maybe_handle) {
62 #ifdef DEBUG 62 #ifdef DEBUG
63 T* a = NULL; 63 T* a = NULL;
64 S* b = NULL; 64 S* b = NULL;
65 a = b; // Fake assignment to enforce type checks. 65 a = b; // Fake assignment to enforce type checks.
66 USE(a); 66 USE(a);
67 #endif 67 #endif
68 location_ = reinterpret_cast<T**>(maybe_handle.location_); 68 location_ = reinterpret_cast<T**>(maybe_handle.location_);
69 } 69 }
70 70
71 INLINE(void Assert()) { ASSERT(location_ != NULL); }
72 INLINE(void Check()) { CHECK(location_ != NULL); }
73
71 INLINE(Handle<T> ToHandleChecked()) { 74 INLINE(Handle<T> ToHandleChecked()) {
72 CHECK(location_ != NULL); 75 Check();
73 return Handle<T>(location_); 76 return Handle<T>(location_);
74 } 77 }
75 78
76 // Convert to a Handle with a type that can be upcasted to. 79 // Convert to a Handle with a type that can be upcasted to.
77 template <class S> INLINE(bool ToHandle(Handle<S>* out)) { 80 template <class S> INLINE(bool ToHandle(Handle<S>* out)) {
78 if (location_ == NULL) { 81 if (location_ == NULL) {
79 *out = Handle<T>::null(); 82 *out = Handle<T>::null();
80 return false; 83 return false;
81 } else { 84 } else {
82 *out = Handle<T>(location_); 85 *out = Handle<T>(location_);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 // an object of expected type, or the handle is an error if running out 287 // an object of expected type, or the handle is an error if running out
285 // of space or encountering an internal error. 288 // of space or encountering an internal error.
286 289
287 // Flattens a string. 290 // Flattens a string.
288 void FlattenString(Handle<String> str); 291 void FlattenString(Handle<String> str);
289 292
290 // Flattens a string and returns the underlying external or sequential 293 // Flattens a string and returns the underlying external or sequential
291 // string. 294 // string.
292 Handle<String> FlattenGetString(Handle<String> str); 295 Handle<String> FlattenGetString(Handle<String> str);
293 296
294 Handle<Object> ForceSetProperty(Handle<JSObject> object,
295 Handle<Object> key,
296 Handle<Object> value,
297 PropertyAttributes attributes);
298
299 Handle<Object> DeleteProperty(Handle<JSObject> object, Handle<Object> key); 297 Handle<Object> DeleteProperty(Handle<JSObject> object, Handle<Object> key);
300 298
301 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, Handle<Object> key); 299 Handle<Object> ForceDeleteProperty(Handle<JSObject> object, Handle<Object> key);
302 300
303 Handle<Object> HasProperty(Handle<JSReceiver> obj, Handle<Object> key); 301 Handle<Object> HasProperty(Handle<JSReceiver> obj, Handle<Object> key);
304 302
305 Handle<Object> GetProperty(Handle<JSReceiver> obj, const char* name); 303 Handle<Object> GetProperty(Handle<JSReceiver> obj, const char* name);
306 304
307 Handle<String> LookupSingleCharacterStringFromCode(Isolate* isolate, 305 Handle<String> LookupSingleCharacterStringFromCode(Isolate* isolate,
308 uint32_t index); 306 uint32_t index);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 381
384 void Initialize() { 382 void Initialize() {
385 next = limit = NULL; 383 next = limit = NULL;
386 level = 0; 384 level = 0;
387 } 385 }
388 }; 386 };
389 387
390 } } // namespace v8::internal 388 } } // namespace v8::internal
391 389
392 #endif // V8_HANDLES_H_ 390 #endif // V8_HANDLES_H_
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698