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

Side by Side Diff: src/runtime.cc

Issue 12459011: Avoid bool to Oddball conversions by being lazy. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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/parser.cc ('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 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 4959 matching lines...) Expand 10 before | Expand all | Expand 10 after
4970 return (object->IsJSObject() && !object->IsGlobalObject()) 4970 return (object->IsJSObject() && !object->IsGlobalObject())
4971 ? JSObject::cast(object)->TransformToFastProperties(0) 4971 ? JSObject::cast(object)->TransformToFastProperties(0)
4972 : object; 4972 : object;
4973 } 4973 }
4974 4974
4975 4975
4976 RUNTIME_FUNCTION(MaybeObject*, Runtime_ToBool) { 4976 RUNTIME_FUNCTION(MaybeObject*, Runtime_ToBool) {
4977 NoHandleAllocation ha(isolate); 4977 NoHandleAllocation ha(isolate);
4978 ASSERT(args.length() == 1); 4978 ASSERT(args.length() == 1);
4979 4979
4980 return args[0]->ToBoolean(); 4980 return isolate->heap()->ToBoolean(args[0]->BooleanValue());
4981 } 4981 }
4982 4982
4983 4983
4984 // Returns the type string of a value; see ECMA-262, 11.4.3 (p 47). 4984 // Returns the type string of a value; see ECMA-262, 11.4.3 (p 47).
4985 // Possible optimizations: put the type string into the oddballs. 4985 // Possible optimizations: put the type string into the oddballs.
4986 RUNTIME_FUNCTION(MaybeObject*, Runtime_Typeof) { 4986 RUNTIME_FUNCTION(MaybeObject*, Runtime_Typeof) {
4987 NoHandleAllocation ha(isolate); 4987 NoHandleAllocation ha(isolate);
4988 4988
4989 Object* obj = args[0]; 4989 Object* obj = args[0];
4990 if (obj->IsNumber()) return isolate->heap()->number_string(); 4990 if (obj->IsNumber()) return isolate->heap()->number_string();
(...skipping 8354 matching lines...) Expand 10 before | Expand all | Expand 10 after
13345 // Handle last resort GC and make sure to allow future allocations 13345 // Handle last resort GC and make sure to allow future allocations
13346 // to grow the heap without causing GCs (if possible). 13346 // to grow the heap without causing GCs (if possible).
13347 isolate->counters()->gc_last_resort_from_js()->Increment(); 13347 isolate->counters()->gc_last_resort_from_js()->Increment();
13348 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13348 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13349 "Runtime::PerformGC"); 13349 "Runtime::PerformGC");
13350 } 13350 }
13351 } 13351 }
13352 13352
13353 13353
13354 } } // namespace v8::internal 13354 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698