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

Side by Side Diff: src/runtime.cc

Issue 8305001: Introduce HTransitionElementsKind instruction. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: nits fixed 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') | src/x64/ic-x64.cc » ('j') | 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 4550 matching lines...) Expand 10 before | Expand all | Expand 10 after
4561 4561
4562 return Runtime::SetObjectProperty(isolate, 4562 return Runtime::SetObjectProperty(isolate,
4563 object, 4563 object,
4564 key, 4564 key,
4565 value, 4565 value,
4566 attributes, 4566 attributes,
4567 strict_mode); 4567 strict_mode);
4568 } 4568 }
4569 4569
4570 4570
4571 MaybeObject* TransitionElements(Handle<Object> object,
4572 ElementsKind to_kind,
4573 Isolate* isolate) {
4574 HandleScope scope(isolate);
4575 if (!object->IsJSObject()) return isolate->ThrowIllegalOperation();
4576 ElementsKind from_kind =
4577 Handle<JSObject>::cast(object)->map()->elements_kind();
4578 if (Map::IsValidElementsTransition(from_kind, to_kind)) {
4579 Handle<Object> result =
4580 TransitionElementsKind(Handle<JSObject>::cast(object), to_kind);
4581 if (result.is_null()) return isolate->ThrowIllegalOperation();
4582 return *result;
4583 }
4584 return isolate->ThrowIllegalOperation();
4585 }
4586
4587
4588 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsSmiToDouble) {
4589 NoHandleAllocation ha;
4590 RUNTIME_ASSERT(args.length() == 1);
4591 Handle<Object> object = args.at<Object>(0);
4592 return TransitionElements(object, FAST_DOUBLE_ELEMENTS, isolate);
4593 }
4594
4595
4596 RUNTIME_FUNCTION(MaybeObject*, Runtime_TransitionElementsDoubleToObject) {
4597 NoHandleAllocation ha;
4598 RUNTIME_ASSERT(args.length() == 1);
4599 Handle<Object> object = args.at<Object>(0);
4600 return TransitionElements(object, FAST_ELEMENTS, isolate);
4601 }
4602
4603
4571 // Set the native flag on the function. 4604 // Set the native flag on the function.
4572 // This is used to decide if we should transform null and undefined 4605 // This is used to decide if we should transform null and undefined
4573 // into the global object when doing call and apply. 4606 // into the global object when doing call and apply.
4574 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) { 4607 RUNTIME_FUNCTION(MaybeObject*, Runtime_SetNativeFlag) {
4575 NoHandleAllocation ha; 4608 NoHandleAllocation ha;
4576 RUNTIME_ASSERT(args.length() == 1); 4609 RUNTIME_ASSERT(args.length() == 1);
4577 4610
4578 Handle<Object> object = args.at<Object>(0); 4611 Handle<Object> object = args.at<Object>(0);
4579 4612
4580 if (object->IsJSFunction()) { 4613 if (object->IsJSFunction()) {
(...skipping 8707 matching lines...) Expand 10 before | Expand all | Expand 10 after
13288 } else { 13321 } else {
13289 // Handle last resort GC and make sure to allow future allocations 13322 // Handle last resort GC and make sure to allow future allocations
13290 // to grow the heap without causing GCs (if possible). 13323 // to grow the heap without causing GCs (if possible).
13291 isolate->counters()->gc_last_resort_from_js()->Increment(); 13324 isolate->counters()->gc_last_resort_from_js()->Increment();
13292 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); 13325 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags);
13293 } 13326 }
13294 } 13327 }
13295 13328
13296 13329
13297 } } // namespace v8::internal 13330 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/x64/ic-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698