| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 static int NumberOfHandles(); | 119 static int NumberOfHandles(); |
| 120 | 120 |
| 121 // Creates a new handle with the given value. | 121 // Creates a new handle with the given value. |
| 122 static inline Object** CreateHandle(Object* value) { | 122 static inline Object** CreateHandle(Object* value) { |
| 123 void** result = current_.next; | 123 void** result = current_.next; |
| 124 if (result == current_.limit) result = Extend(); | 124 if (result == current_.limit) result = Extend(); |
| 125 // Update the current next field, set the value in the created | 125 // Update the current next field, set the value in the created |
| 126 // handle, and return the result. | 126 // handle, and return the result. |
| 127 ASSERT(result < current_.limit); | 127 ASSERT(result < current_.limit); |
| 128 current_.next = result + 1; | 128 current_.next = result + 1; |
| 129 *reinterpret_cast<Object**>(result) = value; | 129 memcpy(result, &value, sizeof(value)); |
| 130 return reinterpret_cast<Object**>(result); | 130 return reinterpret_cast<Object**>(result); |
| 131 } | 131 } |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 // Prevent heap allocation or illegal handle scopes. | 134 // Prevent heap allocation or illegal handle scopes. |
| 135 HandleScope(const HandleScope&); | 135 HandleScope(const HandleScope&); |
| 136 void operator=(const HandleScope&); | 136 void operator=(const HandleScope&); |
| 137 void* operator new(size_t size); | 137 void* operator new(size_t size); |
| 138 void operator delete(void* size_t); | 138 void operator delete(void* size_t); |
| 139 | 139 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 private: | 343 private: |
| 344 bool has_been_transformed_; // Tells whether the object has been transformed. | 344 bool has_been_transformed_; // Tells whether the object has been transformed. |
| 345 int unused_property_fields_; // Captures the unused number of field. | 345 int unused_property_fields_; // Captures the unused number of field. |
| 346 Handle<JSObject> object_; // The object being optimized. | 346 Handle<JSObject> object_; // The object being optimized. |
| 347 }; | 347 }; |
| 348 | 348 |
| 349 | 349 |
| 350 } } // namespace v8::internal | 350 } } // namespace v8::internal |
| 351 | 351 |
| 352 #endif // V8_HANDLES_H_ | 352 #endif // V8_HANDLES_H_ |
| OLD | NEW |