| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Call the specified converter on the object *comand store the result in | 96 // Call the specified converter on the object *comand store the result in |
| 97 // a variable of the specified type with the given name. If the | 97 // a variable of the specified type with the given name. If the |
| 98 // object is not a Number call IllegalOperation and return. | 98 // object is not a Number call IllegalOperation and return. |
| 99 #define CONVERT_NUMBER_CHECKED(type, name, Type, obj) \ | 99 #define CONVERT_NUMBER_CHECKED(type, name, Type, obj) \ |
| 100 RUNTIME_ASSERT(obj->IsNumber()); \ | 100 RUNTIME_ASSERT(obj->IsNumber()); \ |
| 101 type name = NumberTo##Type(obj); | 101 type name = NumberTo##Type(obj); |
| 102 | 102 |
| 103 | 103 |
| 104 MUST_USE_RESULT static Object* DeepCopyBoilerplate(Heap* heap, | 104 MUST_USE_RESULT static Object* DeepCopyBoilerplate(Heap* heap, |
| 105 JSObject* boilerplate) { | 105 JSObject* boilerplate) { |
| 106 StackLimitCheck check; | 106 StackLimitCheck check(heap->isolate()); |
| 107 if (check.HasOverflowed()) return heap->isolate()->StackOverflow(); | 107 if (check.HasOverflowed()) return heap->isolate()->StackOverflow(); |
| 108 | 108 |
| 109 Object* result = heap->CopyJSObject(boilerplate); | 109 Object* result = heap->CopyJSObject(boilerplate); |
| 110 if (result->IsFailure()) return result; | 110 if (result->IsFailure()) return result; |
| 111 JSObject* copy = JSObject::cast(result); | 111 JSObject* copy = JSObject::cast(result); |
| 112 | 112 |
| 113 // Deep copy local properties. | 113 // Deep copy local properties. |
| 114 if (copy->HasFastProperties()) { | 114 if (copy->HasFastProperties()) { |
| 115 FixedArray* properties = copy->properties(); | 115 FixedArray* properties = copy->properties(); |
| 116 for (int i = 0; i < properties->length(); i++) { | 116 for (int i = 0; i < properties->length(); i++) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Deep copy local elements. | 161 // Deep copy local elements. |
| 162 // Pixel elements cannot be created using an object literal. | 162 // Pixel elements cannot be created using an object literal. |
| 163 ASSERT(!copy->HasPixelElements() && !copy->HasExternalArrayElements()); | 163 ASSERT(!copy->HasPixelElements() && !copy->HasExternalArrayElements()); |
| 164 switch (copy->GetElementsKind()) { | 164 switch (copy->GetElementsKind()) { |
| 165 case JSObject::FAST_ELEMENTS: { | 165 case JSObject::FAST_ELEMENTS: { |
| 166 FixedArray* elements = FixedArray::cast(copy->elements()); | 166 FixedArray* elements = FixedArray::cast(copy->elements()); |
| 167 if (elements->map() == HEAP->fixed_cow_array_map()) { | 167 if (elements->map() == heap->fixed_cow_array_map()) { |
| 168 COUNTERS->cow_arrays_created_runtime()->Increment(); | 168 heap->isolate()->counters()->cow_arrays_created_runtime()->Increment(); |
| 169 #ifdef DEBUG | 169 #ifdef DEBUG |
| 170 for (int i = 0; i < elements->length(); i++) { | 170 for (int i = 0; i < elements->length(); i++) { |
| 171 ASSERT(!elements->get(i)->IsJSObject()); | 171 ASSERT(!elements->get(i)->IsJSObject()); |
| 172 } | 172 } |
| 173 #endif | 173 #endif |
| 174 } else { | 174 } else { |
| 175 for (int i = 0; i < elements->length(); i++) { | 175 for (int i = 0; i < elements->length(); i++) { |
| 176 Object* value = elements->get(i); | 176 Object* value = elements->get(i); |
| 177 if (value->IsJSObject()) { | 177 if (value->IsJSObject()) { |
| 178 JSObject* js_object = JSObject::cast(value); | 178 JSObject* js_object = JSObject::cast(value); |
| (...skipping 10719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10898 #define SETUP_RUNTIME_ENTRIES(Name, argc, resize) \ | 10898 #define SETUP_RUNTIME_ENTRIES(Name, argc, resize) \ |
| 10899 entries_[lut_index].method = &CodeGenerator::Generate##Name; \ | 10899 entries_[lut_index].method = &CodeGenerator::Generate##Name; \ |
| 10900 entries_[lut_index].name = "_" #Name; \ | 10900 entries_[lut_index].name = "_" #Name; \ |
| 10901 entries_[lut_index++].nargs = argc; | 10901 entries_[lut_index++].nargs = argc; |
| 10902 INLINE_RUNTIME_FUNCTION_LIST(SETUP_RUNTIME_ENTRIES); | 10902 INLINE_RUNTIME_FUNCTION_LIST(SETUP_RUNTIME_ENTRIES); |
| 10903 #undef SETUP_RUNTIME_ENTRIES | 10903 #undef SETUP_RUNTIME_ENTRIES |
| 10904 } | 10904 } |
| 10905 | 10905 |
| 10906 | 10906 |
| 10907 } } // namespace v8::internal | 10907 } } // namespace v8::internal |
| OLD | NEW |