| 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 4362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4373 if (key->AsArrayIndex(&index)) { | 4373 if (key->AsArrayIndex(&index)) { |
| 4374 if (index < n) { | 4374 if (index < n) { |
| 4375 return frame->GetParameter(index); | 4375 return frame->GetParameter(index); |
| 4376 } else { | 4376 } else { |
| 4377 return Top::initial_object_prototype()->GetElement(index); | 4377 return Top::initial_object_prototype()->GetElement(index); |
| 4378 } | 4378 } |
| 4379 } | 4379 } |
| 4380 | 4380 |
| 4381 // Handle special arguments properties. | 4381 // Handle special arguments properties. |
| 4382 if (key->Equals(Heap::length_symbol())) return Smi::FromInt(n); | 4382 if (key->Equals(Heap::length_symbol())) return Smi::FromInt(n); |
| 4383 if (key->Equals(Heap::callee_symbol())) return frame->function(); | 4383 if (key->Equals(Heap::callee_symbol())) { |
| 4384 Object* function = frame->function(); |
| 4385 if (function->IsJSFunction() && |
| 4386 JSFunction::cast(function)->shared()->strict_mode()) { |
| 4387 return Top::Throw(*Factory::NewTypeError("strict_arguments_callee", |
| 4388 HandleVector<Object>(NULL, 0))); |
| 4389 } |
| 4390 return function; |
| 4391 } |
| 4384 | 4392 |
| 4385 // Lookup in the initial Object.prototype object. | 4393 // Lookup in the initial Object.prototype object. |
| 4386 return Top::initial_object_prototype()->GetProperty(*key); | 4394 return Top::initial_object_prototype()->GetProperty(*key); |
| 4387 } | 4395 } |
| 4388 | 4396 |
| 4389 | 4397 |
| 4390 static MaybeObject* Runtime_ToFastProperties(Arguments args) { | 4398 static MaybeObject* Runtime_ToFastProperties(Arguments args) { |
| 4391 HandleScope scope; | 4399 HandleScope scope; |
| 4392 | 4400 |
| 4393 ASSERT(args.length() == 1); | 4401 ASSERT(args.length() == 1); |
| (...skipping 3650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8044 | 8052 |
| 8045 | 8053 |
| 8046 static MaybeObject* Runtime_SetNewFunctionAttributes(Arguments args) { | 8054 static MaybeObject* Runtime_SetNewFunctionAttributes(Arguments args) { |
| 8047 // This utility adjusts the property attributes for newly created Function | 8055 // This utility adjusts the property attributes for newly created Function |
| 8048 // object ("new Function(...)") by changing the map. | 8056 // object ("new Function(...)") by changing the map. |
| 8049 // All it does is changing the prototype property to enumerable | 8057 // All it does is changing the prototype property to enumerable |
| 8050 // as specified in ECMA262, 15.3.5.2. | 8058 // as specified in ECMA262, 15.3.5.2. |
| 8051 HandleScope scope; | 8059 HandleScope scope; |
| 8052 ASSERT(args.length() == 1); | 8060 ASSERT(args.length() == 1); |
| 8053 CONVERT_ARG_CHECKED(JSFunction, func, 0); | 8061 CONVERT_ARG_CHECKED(JSFunction, func, 0); |
| 8054 ASSERT(func->map()->instance_type() == | 8062 |
| 8055 Top::function_instance_map()->instance_type()); | 8063 Handle<Map> map = func->shared()->strict_mode() |
| 8056 ASSERT(func->map()->instance_size() == | 8064 ? Top::strict_mode_function_instance_map() |
| 8057 Top::function_instance_map()->instance_size()); | 8065 : Top::function_instance_map(); |
| 8058 func->set_map(*Top::function_instance_map()); | 8066 |
| 8067 ASSERT(func->map()->instance_type() == map->instance_type()); |
| 8068 ASSERT(func->map()->instance_size() == map->instance_size()); |
| 8069 func->set_map(*map); |
| 8059 return *func; | 8070 return *func; |
| 8060 } | 8071 } |
| 8061 | 8072 |
| 8062 | 8073 |
| 8063 static MaybeObject* Runtime_AllocateInNewSpace(Arguments args) { | 8074 static MaybeObject* Runtime_AllocateInNewSpace(Arguments args) { |
| 8064 // Allocate a block of memory in NewSpace (filled with a filler). | 8075 // Allocate a block of memory in NewSpace (filled with a filler). |
| 8065 // Use as fallback for allocation in generated code when NewSpace | 8076 // Use as fallback for allocation in generated code when NewSpace |
| 8066 // is full. | 8077 // is full. |
| 8067 ASSERT(args.length() == 1); | 8078 ASSERT(args.length() == 1); |
| 8068 CONVERT_ARG_CHECKED(Smi, size_smi, 0); | 8079 CONVERT_ARG_CHECKED(Smi, size_smi, 0); |
| (...skipping 3609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11678 } else { | 11689 } else { |
| 11679 // Handle last resort GC and make sure to allow future allocations | 11690 // Handle last resort GC and make sure to allow future allocations |
| 11680 // to grow the heap without causing GCs (if possible). | 11691 // to grow the heap without causing GCs (if possible). |
| 11681 Counters::gc_last_resort_from_js.Increment(); | 11692 Counters::gc_last_resort_from_js.Increment(); |
| 11682 Heap::CollectAllGarbage(Heap::kNoGCFlags); | 11693 Heap::CollectAllGarbage(Heap::kNoGCFlags); |
| 11683 } | 11694 } |
| 11684 } | 11695 } |
| 11685 | 11696 |
| 11686 | 11697 |
| 11687 } } // namespace v8::internal | 11698 } } // namespace v8::internal |
| OLD | NEW |