OLD | NEW |
---|---|
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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 // simple object literal. | 328 // simple object literal. |
329 Handle<FixedArray> array = Handle<FixedArray>::cast(value); | 329 Handle<FixedArray> array = Handle<FixedArray>::cast(value); |
330 value = CreateLiteralBoilerplate(literals, array); | 330 value = CreateLiteralBoilerplate(literals, array); |
331 if (value.is_null()) return value; | 331 if (value.is_null()) return value; |
332 } | 332 } |
333 Handle<Object> result; | 333 Handle<Object> result; |
334 uint32_t element_index = 0; | 334 uint32_t element_index = 0; |
335 if (key->IsSymbol()) { | 335 if (key->IsSymbol()) { |
336 if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) { | 336 if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) { |
337 // Array index as string (uint32). | 337 // Array index as string (uint32). |
338 result = SetOwnElement(boilerplate, element_index, value); | 338 result = SetOwnElement(boilerplate, |
339 element_index, | |
340 value, | |
341 kNonStrictMode); | |
339 } else { | 342 } else { |
340 Handle<String> name(String::cast(*key)); | 343 Handle<String> name(String::cast(*key)); |
341 ASSERT(!name->AsArrayIndex(&element_index)); | 344 ASSERT(!name->AsArrayIndex(&element_index)); |
342 result = SetLocalPropertyIgnoreAttributes(boilerplate, name, | 345 result = SetLocalPropertyIgnoreAttributes(boilerplate, name, |
343 value, NONE); | 346 value, NONE); |
344 } | 347 } |
345 } else if (key->ToArrayIndex(&element_index)) { | 348 } else if (key->ToArrayIndex(&element_index)) { |
346 // Array index (uint32). | 349 // Array index (uint32). |
347 result = SetOwnElement(boilerplate, element_index, value); | 350 result = SetOwnElement(boilerplate, |
351 element_index, | |
352 value, | |
353 kNonStrictMode); | |
348 } else { | 354 } else { |
349 // Non-uint32 number. | 355 // Non-uint32 number. |
350 ASSERT(key->IsNumber()); | 356 ASSERT(key->IsNumber()); |
351 double num = key->Number(); | 357 double num = key->Number(); |
352 char arr[100]; | 358 char arr[100]; |
353 Vector<char> buffer(arr, ARRAY_SIZE(arr)); | 359 Vector<char> buffer(arr, ARRAY_SIZE(arr)); |
354 const char* str = DoubleToCString(num, buffer); | 360 const char* str = DoubleToCString(num, buffer); |
355 Handle<String> name = Factory::NewStringFromAscii(CStrVector(str)); | 361 Handle<String> name = Factory::NewStringFromAscii(CStrVector(str)); |
356 result = SetLocalPropertyIgnoreAttributes(boilerplate, name, | 362 result = SetLocalPropertyIgnoreAttributes(boilerplate, name, |
357 value, NONE); | 363 value, NONE); |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1177 // the function context or the arguments object. | 1183 // the function context or the arguments object. |
1178 if (holder->IsContext()) { | 1184 if (holder->IsContext()) { |
1179 ASSERT(holder.is_identical_to(context)); | 1185 ASSERT(holder.is_identical_to(context)); |
1180 if (((attributes & READ_ONLY) == 0) || | 1186 if (((attributes & READ_ONLY) == 0) || |
1181 context->get(index)->IsTheHole()) { | 1187 context->get(index)->IsTheHole()) { |
1182 context->set(index, *initial_value); | 1188 context->set(index, *initial_value); |
1183 } | 1189 } |
1184 } else { | 1190 } else { |
1185 // The holder is an arguments object. | 1191 // The holder is an arguments object. |
1186 Handle<JSObject> arguments(Handle<JSObject>::cast(holder)); | 1192 Handle<JSObject> arguments(Handle<JSObject>::cast(holder)); |
1187 Handle<Object> result = SetElement(arguments, index, initial_value); | 1193 Handle<Object> result = SetElement(arguments, index, initial_value, |
1194 kNonStrictMode); | |
1188 if (result.is_null()) return Failure::Exception(); | 1195 if (result.is_null()) return Failure::Exception(); |
1189 } | 1196 } |
1190 } else { | 1197 } else { |
1191 // Slow case: The property is not in the FixedArray part of the context. | 1198 // Slow case: The property is not in the FixedArray part of the context. |
1192 Handle<JSObject> context_ext = Handle<JSObject>::cast(holder); | 1199 Handle<JSObject> context_ext = Handle<JSObject>::cast(holder); |
1193 RETURN_IF_EMPTY_HANDLE( | 1200 RETURN_IF_EMPTY_HANDLE( |
1194 SetProperty(context_ext, name, initial_value, | 1201 SetProperty(context_ext, name, initial_value, |
1195 mode, kNonStrictMode)); | 1202 mode, kNonStrictMode)); |
1196 } | 1203 } |
1197 } | 1204 } |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1462 // should have been a const redeclaration error when declaring | 1469 // should have been a const redeclaration error when declaring |
1463 // the const property. | 1470 // the const property. |
1464 ASSERT(!holder.is_identical_to(context)); | 1471 ASSERT(!holder.is_identical_to(context)); |
1465 if ((attributes & READ_ONLY) == 0) { | 1472 if ((attributes & READ_ONLY) == 0) { |
1466 Handle<Context>::cast(holder)->set(index, *value); | 1473 Handle<Context>::cast(holder)->set(index, *value); |
1467 } | 1474 } |
1468 } else { | 1475 } else { |
1469 // The holder is an arguments object. | 1476 // The holder is an arguments object. |
1470 ASSERT((attributes & READ_ONLY) == 0); | 1477 ASSERT((attributes & READ_ONLY) == 0); |
1471 Handle<JSObject> arguments(Handle<JSObject>::cast(holder)); | 1478 Handle<JSObject> arguments(Handle<JSObject>::cast(holder)); |
1472 SetElement(arguments, index, value); | 1479 SetElement(arguments, index, value, kNonStrictMode); |
1473 } | 1480 } |
1474 return *value; | 1481 return *value; |
1475 } | 1482 } |
1476 | 1483 |
1477 // The property could not be found, we introduce it in the global | 1484 // The property could not be found, we introduce it in the global |
1478 // context. | 1485 // context. |
1479 if (attributes == ABSENT) { | 1486 if (attributes == ABSENT) { |
1480 Handle<JSObject> global = Handle<JSObject>(Top::context()->global()); | 1487 Handle<JSObject> global = Handle<JSObject>(Top::context()->global()); |
1481 // Strict mode not needed (const disallowed in strict mode). | 1488 // Strict mode not needed (const disallowed in strict mode). |
1482 RETURN_IF_EMPTY_HANDLE( | 1489 RETURN_IF_EMPTY_HANDLE( |
(...skipping 2322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3805 // of a string using [] notation. We need to support this too in | 3812 // of a string using [] notation. We need to support this too in |
3806 // JavaScript. | 3813 // JavaScript. |
3807 // In the case of a String object we just need to redirect the assignment to | 3814 // In the case of a String object we just need to redirect the assignment to |
3808 // the underlying string if the index is in range. Since the underlying | 3815 // the underlying string if the index is in range. Since the underlying |
3809 // string does nothing with the assignment then we can ignore such | 3816 // string does nothing with the assignment then we can ignore such |
3810 // assignments. | 3817 // assignments. |
3811 if (js_object->IsStringObjectWithCharacterAt(index)) { | 3818 if (js_object->IsStringObjectWithCharacterAt(index)) { |
3812 return *value; | 3819 return *value; |
3813 } | 3820 } |
3814 | 3821 |
3815 // TODO(1220): Implement SetElement strict mode. | 3822 Handle<Object> result = SetElement(js_object, index, value, strict); |
3816 Handle<Object> result = SetElement(js_object, index, value); | |
3817 if (result.is_null()) return Failure::Exception(); | 3823 if (result.is_null()) return Failure::Exception(); |
3818 return *value; | 3824 return *value; |
3819 } | 3825 } |
3820 | 3826 |
3821 if (key->IsString()) { | 3827 if (key->IsString()) { |
3822 Handle<Object> result; | 3828 Handle<Object> result; |
3823 if (Handle<String>::cast(key)->AsArrayIndex(&index)) { | 3829 if (Handle<String>::cast(key)->AsArrayIndex(&index)) { |
3824 result = SetElement(js_object, index, value); | 3830 result = SetElement(js_object, index, value, strict); |
3825 } else { | 3831 } else { |
3826 Handle<String> key_string = Handle<String>::cast(key); | 3832 Handle<String> key_string = Handle<String>::cast(key); |
3827 key_string->TryFlatten(); | 3833 key_string->TryFlatten(); |
3828 result = SetProperty(js_object, key_string, value, attr, strict); | 3834 result = SetProperty(js_object, key_string, value, attr, strict); |
3829 } | 3835 } |
3830 if (result.is_null()) return Failure::Exception(); | 3836 if (result.is_null()) return Failure::Exception(); |
3831 return *value; | 3837 return *value; |
3832 } | 3838 } |
3833 | 3839 |
3834 // Call-back into JavaScript to convert the key to a string. | 3840 // Call-back into JavaScript to convert the key to a string. |
3835 bool has_pending_exception = false; | 3841 bool has_pending_exception = false; |
3836 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); | 3842 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); |
3837 if (has_pending_exception) return Failure::Exception(); | 3843 if (has_pending_exception) return Failure::Exception(); |
3838 Handle<String> name = Handle<String>::cast(converted); | 3844 Handle<String> name = Handle<String>::cast(converted); |
3839 | 3845 |
3840 if (name->AsArrayIndex(&index)) { | 3846 if (name->AsArrayIndex(&index)) { |
3841 // TODO(1220): Implement SetElement strict mode. | 3847 return js_object->SetElement(index, *value, strict); |
3842 return js_object->SetElement(index, *value); | |
3843 } else { | 3848 } else { |
3844 return js_object->SetProperty(*name, *value, attr, strict); | 3849 return js_object->SetProperty(*name, *value, attr, strict); |
3845 } | 3850 } |
3846 } | 3851 } |
3847 | 3852 |
3848 | 3853 |
3849 MaybeObject* Runtime::ForceSetObjectProperty(Handle<JSObject> js_object, | 3854 MaybeObject* Runtime::ForceSetObjectProperty(Handle<JSObject> js_object, |
3850 Handle<Object> key, | 3855 Handle<Object> key, |
3851 Handle<Object> value, | 3856 Handle<Object> value, |
3852 PropertyAttributes attr) { | 3857 PropertyAttributes attr) { |
3853 HandleScope scope; | 3858 HandleScope scope; |
3854 | 3859 |
3855 // Check if the given key is an array index. | 3860 // Check if the given key is an array index. |
3856 uint32_t index; | 3861 uint32_t index; |
3857 if (key->ToArrayIndex(&index)) { | 3862 if (key->ToArrayIndex(&index)) { |
3858 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters | 3863 // In Firefox/SpiderMonkey, Safari and Opera you can access the characters |
3859 // of a string using [] notation. We need to support this too in | 3864 // of a string using [] notation. We need to support this too in |
3860 // JavaScript. | 3865 // JavaScript. |
3861 // In the case of a String object we just need to redirect the assignment to | 3866 // In the case of a String object we just need to redirect the assignment to |
3862 // the underlying string if the index is in range. Since the underlying | 3867 // the underlying string if the index is in range. Since the underlying |
3863 // string does nothing with the assignment then we can ignore such | 3868 // string does nothing with the assignment then we can ignore such |
3864 // assignments. | 3869 // assignments. |
3865 if (js_object->IsStringObjectWithCharacterAt(index)) { | 3870 if (js_object->IsStringObjectWithCharacterAt(index)) { |
3866 return *value; | 3871 return *value; |
3867 } | 3872 } |
3868 | 3873 |
3869 return js_object->SetElement(index, *value); | 3874 return js_object->SetElement(index, *value, kNonStrictMode); |
3870 } | 3875 } |
3871 | 3876 |
3872 if (key->IsString()) { | 3877 if (key->IsString()) { |
3873 if (Handle<String>::cast(key)->AsArrayIndex(&index)) { | 3878 if (Handle<String>::cast(key)->AsArrayIndex(&index)) { |
3874 return js_object->SetElement(index, *value); | 3879 return js_object->SetElement(index, *value, kNonStrictMode); |
3875 } else { | 3880 } else { |
3876 Handle<String> key_string = Handle<String>::cast(key); | 3881 Handle<String> key_string = Handle<String>::cast(key); |
3877 key_string->TryFlatten(); | 3882 key_string->TryFlatten(); |
3878 return js_object->SetLocalPropertyIgnoreAttributes(*key_string, | 3883 return js_object->SetLocalPropertyIgnoreAttributes(*key_string, |
3879 *value, | 3884 *value, |
3880 attr); | 3885 attr); |
3881 } | 3886 } |
3882 } | 3887 } |
3883 | 3888 |
3884 // Call-back into JavaScript to convert the key to a string. | 3889 // Call-back into JavaScript to convert the key to a string. |
3885 bool has_pending_exception = false; | 3890 bool has_pending_exception = false; |
3886 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); | 3891 Handle<Object> converted = Execution::ToString(key, &has_pending_exception); |
3887 if (has_pending_exception) return Failure::Exception(); | 3892 if (has_pending_exception) return Failure::Exception(); |
3888 Handle<String> name = Handle<String>::cast(converted); | 3893 Handle<String> name = Handle<String>::cast(converted); |
3889 | 3894 |
3890 if (name->AsArrayIndex(&index)) { | 3895 if (name->AsArrayIndex(&index)) { |
3891 return js_object->SetElement(index, *value); | 3896 return js_object->SetElement(index, *value, kNonStrictMode); |
3892 } else { | 3897 } else { |
3893 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); | 3898 return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr); |
3894 } | 3899 } |
3895 } | 3900 } |
3896 | 3901 |
3897 | 3902 |
3898 MaybeObject* Runtime::ForceDeleteObjectProperty(Handle<JSObject> js_object, | 3903 MaybeObject* Runtime::ForceDeleteObjectProperty(Handle<JSObject> js_object, |
3899 Handle<Object> key) { | 3904 Handle<Object> key) { |
3900 HandleScope scope; | 3905 HandleScope scope; |
3901 | 3906 |
(...skipping 3648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7550 PropertyAttributes attributes; | 7555 PropertyAttributes attributes; |
7551 ContextLookupFlags flags = FOLLOW_CHAINS; | 7556 ContextLookupFlags flags = FOLLOW_CHAINS; |
7552 Handle<Object> holder = context->Lookup(name, flags, &index, &attributes); | 7557 Handle<Object> holder = context->Lookup(name, flags, &index, &attributes); |
7553 | 7558 |
7554 if (index >= 0) { | 7559 if (index >= 0) { |
7555 if (holder->IsContext()) { | 7560 if (holder->IsContext()) { |
7556 // Ignore if read_only variable. | 7561 // Ignore if read_only variable. |
7557 if ((attributes & READ_ONLY) == 0) { | 7562 if ((attributes & READ_ONLY) == 0) { |
7558 // Context is a fixed array and set cannot fail. | 7563 // Context is a fixed array and set cannot fail. |
7559 Context::cast(*holder)->set(index, *value); | 7564 Context::cast(*holder)->set(index, *value); |
7565 } else if (strict == kStrictMode) { | |
7566 // Setting read only property in strict mode. | |
7567 Handle<Object> error = | |
7568 Factory::NewTypeError("strict_cannot_assign", | |
7569 HandleVector(&name, 1)); | |
7570 return Top::Throw(*error); | |
7560 } | 7571 } |
7561 } else { | 7572 } else { |
7562 ASSERT((attributes & READ_ONLY) == 0); | 7573 ASSERT((attributes & READ_ONLY) == 0); |
7563 Handle<Object> result = | 7574 Handle<Object> result = |
7564 SetElement(Handle<JSObject>::cast(holder), index, value); | 7575 SetElement(Handle<JSObject>::cast(holder), index, value, strict); |
7565 if (result.is_null()) { | 7576 if (result.is_null()) { |
7566 ASSERT(Top::has_pending_exception()); | 7577 ASSERT(Top::has_pending_exception()); |
7567 return Failure::Exception(); | 7578 return Failure::Exception(); |
7568 } | 7579 } |
7569 } | 7580 } |
7570 return *value; | 7581 return *value; |
7571 } | 7582 } |
7572 | 7583 |
7573 // Slow case: The property is not in a FixedArray context. | 7584 // Slow case: The property is not in a FixedArray context. |
7574 // It is either in an JSObject extension context or it was not found. | 7585 // It is either in an JSObject extension context or it was not found. |
(...skipping 10 matching lines...) Expand all Loading... | |
7585 } | 7596 } |
7586 | 7597 |
7587 // Set the property, but ignore if read_only variable on the context | 7598 // Set the property, but ignore if read_only variable on the context |
7588 // extension object itself. | 7599 // extension object itself. |
7589 if ((attributes & READ_ONLY) == 0 || | 7600 if ((attributes & READ_ONLY) == 0 || |
7590 (context_ext->GetLocalPropertyAttribute(*name) == ABSENT)) { | 7601 (context_ext->GetLocalPropertyAttribute(*name) == ABSENT)) { |
7591 RETURN_IF_EMPTY_HANDLE(SetProperty(context_ext, name, value, NONE, strict)); | 7602 RETURN_IF_EMPTY_HANDLE(SetProperty(context_ext, name, value, NONE, strict)); |
7592 } else if (strict == kStrictMode && (attributes & READ_ONLY) != 0) { | 7603 } else if (strict == kStrictMode && (attributes & READ_ONLY) != 0) { |
7593 // Setting read only property in strict mode. | 7604 // Setting read only property in strict mode. |
7594 Handle<Object> error = | 7605 Handle<Object> error = |
7595 Factory::NewTypeError("strict_cannot_assign", HandleVector(&name, 1)); | 7606 Factory::NewTypeError("strict_cannot_assign", HandleVector(&name, 1)); |
7596 return Top::Throw(*error); | 7607 return Top::Throw(*error); |
7597 } | 7608 } |
7598 return *value; | 7609 return *value; |
7599 } | 7610 } |
7600 | 7611 |
7601 | 7612 |
7602 static MaybeObject* Runtime_Throw(Arguments args) { | 7613 static MaybeObject* Runtime_Throw(Arguments args) { |
7603 HandleScope scope; | 7614 HandleScope scope; |
7604 ASSERT(args.length() == 1); | 7615 ASSERT(args.length() == 1); |
7605 | 7616 |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8057 ASSERT(args.length() == 2); | 8068 ASSERT(args.length() == 2); |
8058 CONVERT_CHECKED(JSArray, array, args[0]); | 8069 CONVERT_CHECKED(JSArray, array, args[0]); |
8059 CONVERT_CHECKED(JSObject, element, args[1]); | 8070 CONVERT_CHECKED(JSObject, element, args[1]); |
8060 RUNTIME_ASSERT(array->HasFastElements()); | 8071 RUNTIME_ASSERT(array->HasFastElements()); |
8061 int length = Smi::cast(array->length())->value(); | 8072 int length = Smi::cast(array->length())->value(); |
8062 FixedArray* elements = FixedArray::cast(array->elements()); | 8073 FixedArray* elements = FixedArray::cast(array->elements()); |
8063 for (int i = 0; i < length; i++) { | 8074 for (int i = 0; i < length; i++) { |
8064 if (elements->get(i) == element) return Heap::false_value(); | 8075 if (elements->get(i) == element) return Heap::false_value(); |
8065 } | 8076 } |
8066 Object* obj; | 8077 Object* obj; |
8067 { MaybeObject* maybe_obj = array->SetFastElement(length, element); | 8078 // Strict not needed. Used for cycle detection in Array join implementation. |
8079 { MaybeObject* maybe_obj = array->SetFastElement(length, element, | |
8080 kNonStrictMode); | |
8068 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 8081 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
8069 } | 8082 } |
8070 return Heap::true_value(); | 8083 return Heap::true_value(); |
8071 } | 8084 } |
8072 | 8085 |
8073 | 8086 |
8074 /** | 8087 /** |
8075 * A simple visitor visits every element of Array's. | 8088 * A simple visitor visits every element of Array's. |
8076 * The backend storage can be a fixed array for fast elements case, | 8089 * The backend storage can be a fixed array for fast elements case, |
8077 * or a dictionary for sparse array. Since Dictionary is a subtype | 8090 * or a dictionary for sparse array. Since Dictionary is a subtype |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8652 uint32_t index1, index2; | 8665 uint32_t index1, index2; |
8653 if (!key1->ToArrayIndex(&index1) | 8666 if (!key1->ToArrayIndex(&index1) |
8654 || !key2->ToArrayIndex(&index2)) { | 8667 || !key2->ToArrayIndex(&index2)) { |
8655 return Top::ThrowIllegalOperation(); | 8668 return Top::ThrowIllegalOperation(); |
8656 } | 8669 } |
8657 | 8670 |
8658 Handle<JSObject> jsobject = Handle<JSObject>::cast(object); | 8671 Handle<JSObject> jsobject = Handle<JSObject>::cast(object); |
8659 Handle<Object> tmp1 = GetElement(jsobject, index1); | 8672 Handle<Object> tmp1 = GetElement(jsobject, index1); |
8660 Handle<Object> tmp2 = GetElement(jsobject, index2); | 8673 Handle<Object> tmp2 = GetElement(jsobject, index2); |
8661 | 8674 |
8662 SetElement(jsobject, index1, tmp2); | 8675 SetElement(jsobject, index1, tmp2, kNonStrictMode); |
Martin Maly
2011/03/03 06:07:56
Runtime_SwapElements - used by quick sort. I could
Lasse Reichstein
2011/03/03 09:39:50
It's used only internally in the Array.prototype.s
Lasse Reichstein
2011/03/03 09:44:53
My bad, the spec is fine. It uses [[GetProperty]]
Martin Maly
2011/03/04 00:36:09
Done. Strict mode worked just fine.
| |
8663 SetElement(jsobject, index2, tmp1); | 8676 SetElement(jsobject, index2, tmp1, kNonStrictMode); |
8664 | 8677 |
8665 return Heap::undefined_value(); | 8678 return Heap::undefined_value(); |
8666 } | 8679 } |
8667 | 8680 |
8668 | 8681 |
8669 // Returns an array that tells you where in the [0, length) interval an array | 8682 // Returns an array that tells you where in the [0, length) interval an array |
8670 // might have elements. Can either return keys (positive integers) or | 8683 // might have elements. Can either return keys (positive integers) or |
8671 // intervals (pair of a negative integer (-start-1) followed by a | 8684 // intervals (pair of a negative integer (-start-1) followed by a |
8672 // positive (length)) or undefined values. | 8685 // positive (length)) or undefined values. |
8673 // Intervals can span over some keys that are not in the object. | 8686 // Intervals can span over some keys that are not in the object. |
(...skipping 2612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11286 Handle<JSFunction> fun = frames[i].function(); | 11299 Handle<JSFunction> fun = frames[i].function(); |
11287 Handle<Code> code = frames[i].code(); | 11300 Handle<Code> code = frames[i].code(); |
11288 Handle<Smi> offset(Smi::FromInt(frames[i].offset())); | 11301 Handle<Smi> offset(Smi::FromInt(frames[i].offset())); |
11289 FixedArray* elements = FixedArray::cast(result->elements()); | 11302 FixedArray* elements = FixedArray::cast(result->elements()); |
11290 if (cursor + 3 < elements->length()) { | 11303 if (cursor + 3 < elements->length()) { |
11291 elements->set(cursor++, *recv); | 11304 elements->set(cursor++, *recv); |
11292 elements->set(cursor++, *fun); | 11305 elements->set(cursor++, *fun); |
11293 elements->set(cursor++, *code); | 11306 elements->set(cursor++, *code); |
11294 elements->set(cursor++, *offset); | 11307 elements->set(cursor++, *offset); |
11295 } else { | 11308 } else { |
11296 SetElement(result, cursor++, recv); | 11309 // Strict mode not required for collecting stack trace. |
11297 SetElement(result, cursor++, fun); | 11310 SetElement(result, cursor++, recv, kNonStrictMode); |
11298 SetElement(result, cursor++, code); | 11311 SetElement(result, cursor++, fun, kNonStrictMode); |
11299 SetElement(result, cursor++, offset); | 11312 SetElement(result, cursor++, code, kNonStrictMode); |
11313 SetElement(result, cursor++, offset, kNonStrictMode); | |
11300 } | 11314 } |
11301 } | 11315 } |
11302 } | 11316 } |
11303 iter.Advance(); | 11317 iter.Advance(); |
11304 } | 11318 } |
11305 | 11319 |
11306 result->set_length(Smi::FromInt(cursor)); | 11320 result->set_length(Smi::FromInt(cursor)); |
11307 return *result; | 11321 return *result; |
11308 } | 11322 } |
11309 | 11323 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11476 Handle<String> name; \ | 11490 Handle<String> name; \ |
11477 /* Inline runtime functions have an underscore in front of the name. */ \ | 11491 /* Inline runtime functions have an underscore in front of the name. */ \ |
11478 if (inline_runtime_functions) { \ | 11492 if (inline_runtime_functions) { \ |
11479 name = Factory::NewStringFromAscii( \ | 11493 name = Factory::NewStringFromAscii( \ |
11480 Vector<const char>("_" #Name, StrLength("_" #Name))); \ | 11494 Vector<const char>("_" #Name, StrLength("_" #Name))); \ |
11481 } else { \ | 11495 } else { \ |
11482 name = Factory::NewStringFromAscii( \ | 11496 name = Factory::NewStringFromAscii( \ |
11483 Vector<const char>(#Name, StrLength(#Name))); \ | 11497 Vector<const char>(#Name, StrLength(#Name))); \ |
11484 } \ | 11498 } \ |
11485 Handle<JSArray> pair = Factory::NewJSArray(0); \ | 11499 Handle<JSArray> pair = Factory::NewJSArray(0); \ |
11486 SetElement(pair, 0, name); \ | 11500 SetElement(pair, 0, name, kNonStrictMode); \ |
11487 SetElement(pair, 1, Handle<Smi>(Smi::FromInt(argc))); \ | 11501 SetElement(pair, 1, Handle<Smi>(Smi::FromInt(argc)), kNonStrictMode); \ |
11488 SetElement(result, index++, pair); \ | 11502 SetElement(result, index++, pair, kNonStrictMode); \ |
Martin Maly
2011/03/03 06:07:56
Debug code only, no need for strict mode.
| |
11489 } | 11503 } |
11490 inline_runtime_functions = false; | 11504 inline_runtime_functions = false; |
11491 RUNTIME_FUNCTION_LIST(ADD_ENTRY) | 11505 RUNTIME_FUNCTION_LIST(ADD_ENTRY) |
11492 inline_runtime_functions = true; | 11506 inline_runtime_functions = true; |
11493 INLINE_FUNCTION_LIST(ADD_ENTRY) | 11507 INLINE_FUNCTION_LIST(ADD_ENTRY) |
11494 INLINE_RUNTIME_FUNCTION_LIST(ADD_ENTRY) | 11508 INLINE_RUNTIME_FUNCTION_LIST(ADD_ENTRY) |
11495 #undef ADD_ENTRY | 11509 #undef ADD_ENTRY |
11496 return *result; | 11510 return *result; |
11497 } | 11511 } |
11498 #endif | 11512 #endif |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11583 } else { | 11597 } else { |
11584 // Handle last resort GC and make sure to allow future allocations | 11598 // Handle last resort GC and make sure to allow future allocations |
11585 // to grow the heap without causing GCs (if possible). | 11599 // to grow the heap without causing GCs (if possible). |
11586 Counters::gc_last_resort_from_js.Increment(); | 11600 Counters::gc_last_resort_from_js.Increment(); |
11587 Heap::CollectAllGarbage(false); | 11601 Heap::CollectAllGarbage(false); |
11588 } | 11602 } |
11589 } | 11603 } |
11590 | 11604 |
11591 | 11605 |
11592 } } // namespace v8::internal | 11606 } } // namespace v8::internal |
OLD | NEW |