OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 10341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10352 static_cast<uint32_t>(elements->length()); | 10352 static_cast<uint32_t>(elements->length()); |
10353 uint32_t min_length = actual_length < length ? actual_length : length; | 10353 uint32_t min_length = actual_length < length ? actual_length : length; |
10354 Handle<Object> length_object = | 10354 Handle<Object> length_object = |
10355 isolate->factory()->NewNumber(static_cast<double>(min_length)); | 10355 isolate->factory()->NewNumber(static_cast<double>(min_length)); |
10356 single_interval->set(1, *length_object); | 10356 single_interval->set(1, *length_object); |
10357 return *isolate->factory()->NewJSArrayWithElements(single_interval); | 10357 return *isolate->factory()->NewJSArrayWithElements(single_interval); |
10358 } | 10358 } |
10359 } | 10359 } |
10360 | 10360 |
10361 | 10361 |
10362 // DefineAccessor takes an optional final argument which is the | |
10363 // property attributes (e.g. DONT_ENUM, DONT_DELETE). IMPORTANT: due | |
10364 // to the way accessors are implemented, it is set for both the getter | |
10365 // and setter on the first call to DefineAccessor and ignored on | |
10366 // subsequent calls. | |
10367 RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineAccessor) { | |
10368 RUNTIME_ASSERT(args.length() == 4 || args.length() == 5); | |
10369 // Compute attributes. | |
10370 PropertyAttributes attributes = NONE; | |
10371 if (args.length() == 5) { | |
10372 CONVERT_SMI_ARG_CHECKED(value, 4); | |
10373 // Only attribute bits should be set. | |
10374 ASSERT((value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); | |
10375 attributes = static_cast<PropertyAttributes>(value); | |
10376 } | |
10377 | |
10378 CONVERT_ARG_CHECKED(JSObject, obj, 0); | |
10379 CONVERT_ARG_CHECKED(String, name, 1); | |
10380 CONVERT_SMI_ARG_CHECKED(flag, 2); | |
10381 CONVERT_ARG_CHECKED(JSFunction, fun, 3); | |
10382 return obj->DefineAccessor(name, flag == 0, fun, attributes); | |
10383 } | |
10384 | |
10385 | |
10386 RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) { | 10362 RUNTIME_FUNCTION(MaybeObject*, Runtime_LookupAccessor) { |
10387 ASSERT(args.length() == 3); | 10363 ASSERT(args.length() == 3); |
10388 CONVERT_ARG_CHECKED(JSObject, obj, 0); | 10364 CONVERT_ARG_CHECKED(JSObject, obj, 0); |
10389 CONVERT_ARG_CHECKED(String, name, 1); | 10365 CONVERT_ARG_CHECKED(String, name, 1); |
10390 CONVERT_SMI_ARG_CHECKED(flag, 2); | 10366 CONVERT_SMI_ARG_CHECKED(flag, 2); |
10391 return obj->LookupAccessor(name, flag == 0); | 10367 return obj->LookupAccessor(name, flag == 0); |
10392 } | 10368 } |
10393 | 10369 |
10394 | 10370 |
10395 #ifdef ENABLE_DEBUGGER_SUPPORT | 10371 #ifdef ENABLE_DEBUGGER_SUPPORT |
(...skipping 3305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13701 // Handle last resort GC and make sure to allow future allocations | 13677 // Handle last resort GC and make sure to allow future allocations |
13702 // to grow the heap without causing GCs (if possible). | 13678 // to grow the heap without causing GCs (if possible). |
13703 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13679 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13704 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13680 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
13705 "Runtime::PerformGC"); | 13681 "Runtime::PerformGC"); |
13706 } | 13682 } |
13707 } | 13683 } |
13708 | 13684 |
13709 | 13685 |
13710 } } // namespace v8::internal | 13686 } } // namespace v8::internal |
OLD | NEW |