Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Side by Side Diff: src/runtime.cc

Issue 8359014: Create stub and runtime function for ia32 full-codegen array literal element initialization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4567 matching lines...) Expand 10 before | Expand all | Expand 10 after
4578 Handle<Object> object = args.at<Object>(0); 4578 Handle<Object> object = args.at<Object>(0);
4579 4579
4580 if (object->IsJSFunction()) { 4580 if (object->IsJSFunction()) {
4581 JSFunction* func = JSFunction::cast(*object); 4581 JSFunction* func = JSFunction::cast(*object);
4582 func->shared()->set_native(true); 4582 func->shared()->set_native(true);
4583 } 4583 }
4584 return isolate->heap()->undefined_value(); 4584 return isolate->heap()->undefined_value();
4585 } 4585 }
4586 4586
4587 4587
4588 RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) {
4589 RUNTIME_ASSERT(args.length() == 5);
4590 CONVERT_ARG_CHECKED(JSObject, object, 0);
4591 CONVERT_SMI_ARG_CHECKED(store_index, 1);
4592 Handle<Object> value = args.at<Object>(2);
4593 CONVERT_ARG_CHECKED(FixedArray, literals, 3);
4594 CONVERT_SMI_ARG_CHECKED(literal_index, 4);
4595 HandleScope scope;
4596
4597 Object* raw_boilerplate_object = literals->get(literal_index);
4598 Handle<JSArray> boilerplate_object(JSArray::cast(raw_boilerplate_object));
4599 #if DEBUG
4600 ElementsKind elements_kind = object->GetElementsKind();
4601 #endif
4602 ASSERT(elements_kind <= FAST_DOUBLE_ELEMENTS);
4603 // Smis should never trigger transitions.
4604 ASSERT(!value->IsSmi());
4605
4606 if (value->IsNumber()) {
4607 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS);
4608 TransitionElementsKind(object, FAST_DOUBLE_ELEMENTS);
4609 ASSERT(object->GetElementsKind() == FAST_DOUBLE_ELEMENTS);
4610 FixedDoubleArray* double_array =
4611 FixedDoubleArray::cast(object->elements());
4612 HeapNumber* number = HeapNumber::cast(*value);
4613 double_array->set(store_index, number->Number());
4614 } else {
4615 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS ||
4616 elements_kind == FAST_DOUBLE_ELEMENTS);
4617 TransitionElementsKind(object, FAST_ELEMENTS);
4618 FixedArray* object_array =
4619 FixedArray::cast(object->elements());
4620 object_array->set(store_index, *value);
4621 }
4622 return *object;
4623 }
4624
4625
4588 // Set a local property, even if it is READ_ONLY. If the property does not 4626 // Set a local property, even if it is READ_ONLY. If the property does not
4589 // exist, it will be added with attributes NONE. 4627 // exist, it will be added with attributes NONE.
4590 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { 4628 RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) {
4591 NoHandleAllocation ha; 4629 NoHandleAllocation ha;
4592 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); 4630 RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
4593 CONVERT_CHECKED(JSObject, object, args[0]); 4631 CONVERT_CHECKED(JSObject, object, args[0]);
4594 CONVERT_CHECKED(String, name, args[1]); 4632 CONVERT_CHECKED(String, name, args[1]);
4595 // Compute attributes. 4633 // Compute attributes.
4596 PropertyAttributes attributes = NONE; 4634 PropertyAttributes attributes = NONE;
4597 if (args.length() == 4) { 4635 if (args.length() == 4) {
(...skipping 8744 matching lines...) Expand 10 before | Expand all | Expand 10 after
13342 } else { 13380 } else {
13343 // Handle last resort GC and make sure to allow future allocations 13381 // Handle last resort GC and make sure to allow future allocations
13344 // to grow the heap without causing GCs (if possible). 13382 // to grow the heap without causing GCs (if possible).
13345 isolate->counters()->gc_last_resort_from_js()->Increment(); 13383 isolate->counters()->gc_last_resort_from_js()->Increment();
13346 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); 13384 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags);
13347 } 13385 }
13348 } 13386 }
13349 13387
13350 13388
13351 } } // namespace v8::internal 13389 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698