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

Side by Side Diff: src/runtime.cc

Issue 3078033: Version 2.3.6 (Closed)
Patch Set: Created 10 years, 4 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
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 7569 matching lines...) Expand 10 before | Expand all | Expand 10 after
7580 CONVERT_ARG_CHECKED(JSFunction, func, 0); 7580 CONVERT_ARG_CHECKED(JSFunction, func, 0);
7581 ASSERT(func->map()->instance_type() == 7581 ASSERT(func->map()->instance_type() ==
7582 Top::function_instance_map()->instance_type()); 7582 Top::function_instance_map()->instance_type());
7583 ASSERT(func->map()->instance_size() == 7583 ASSERT(func->map()->instance_size() ==
7584 Top::function_instance_map()->instance_size()); 7584 Top::function_instance_map()->instance_size());
7585 func->set_map(*Top::function_instance_map()); 7585 func->set_map(*Top::function_instance_map());
7586 return *func; 7586 return *func;
7587 } 7587 }
7588 7588
7589 7589
7590 static Object* Runtime_AllocateInNewSpace(Arguments args) {
7591 // Allocate a block of memory in NewSpace (filled with a filler).
7592 // Use as fallback for allocation in generated code when NewSpace
7593 // is full.
7594 ASSERT(args.length() == 1);
7595 CONVERT_ARG_CHECKED(Smi, size_smi, 0);
7596 int size = size_smi->value();
7597 RUNTIME_ASSERT(IsAligned(size, kPointerSize));
7598 RUNTIME_ASSERT(size > 0);
7599 static const int kMinFreeNewSpaceAfterGC =
7600 Heap::InitialSemiSpaceSize() * 3/4;
7601 RUNTIME_ASSERT(size <= kMinFreeNewSpaceAfterGC);
7602 Object* allocation = Heap::new_space()->AllocateRaw(size);
7603 if (!allocation->IsFailure()) {
7604 Heap::CreateFillerObjectAt(HeapObject::cast(allocation)->address(), size);
7605 }
7606 return allocation;
7607 }
7608
7609
7590 // Push an array unto an array of arrays if it is not already in the 7610 // Push an array unto an array of arrays if it is not already in the
7591 // array. Returns true if the element was pushed on the stack and 7611 // array. Returns true if the element was pushed on the stack and
7592 // false otherwise. 7612 // false otherwise.
7593 static Object* Runtime_PushIfAbsent(Arguments args) { 7613 static Object* Runtime_PushIfAbsent(Arguments args) {
7594 ASSERT(args.length() == 2); 7614 ASSERT(args.length() == 2);
7595 CONVERT_CHECKED(JSArray, array, args[0]); 7615 CONVERT_CHECKED(JSArray, array, args[0]);
7596 CONVERT_CHECKED(JSArray, element, args[1]); 7616 CONVERT_CHECKED(JSArray, element, args[1]);
7597 RUNTIME_ASSERT(array->HasFastElements()); 7617 RUNTIME_ASSERT(array->HasFastElements());
7598 int length = Smi::cast(array->length())->value(); 7618 int length = Smi::cast(array->length())->value();
7599 FixedArray* elements = FixedArray::cast(array->elements()); 7619 FixedArray* elements = FixedArray::cast(array->elements());
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after
10599 } else { 10619 } else {
10600 // Handle last resort GC and make sure to allow future allocations 10620 // Handle last resort GC and make sure to allow future allocations
10601 // to grow the heap without causing GCs (if possible). 10621 // to grow the heap without causing GCs (if possible).
10602 Counters::gc_last_resort_from_js.Increment(); 10622 Counters::gc_last_resort_from_js.Increment();
10603 Heap::CollectAllGarbage(false); 10623 Heap::CollectAllGarbage(false);
10604 } 10624 }
10605 } 10625 }
10606 10626
10607 10627
10608 } } // namespace v8::internal 10628 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/string.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698