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

Side by Side Diff: src/objects.cc

Issue 40290: Experimental: Merge 1395:1441 from bleeding_edge branch to the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/global/
Patch Set: Created 11 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/objects.h ('k') | src/objects-debug.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 4854 matching lines...) Expand 10 before | Expand all | Expand 10 after
4865 case MONOMORPHIC_PROTOTYPE_FAILURE: return "MONOMORPHIC_PROTOTYPE_FAILURE"; 4865 case MONOMORPHIC_PROTOTYPE_FAILURE: return "MONOMORPHIC_PROTOTYPE_FAILURE";
4866 case MEGAMORPHIC: return "MEGAMORPHIC"; 4866 case MEGAMORPHIC: return "MEGAMORPHIC";
4867 case DEBUG_BREAK: return "DEBUG_BREAK"; 4867 case DEBUG_BREAK: return "DEBUG_BREAK";
4868 case DEBUG_PREPARE_STEP_IN: return "DEBUG_PREPARE_STEP_IN"; 4868 case DEBUG_PREPARE_STEP_IN: return "DEBUG_PREPARE_STEP_IN";
4869 } 4869 }
4870 UNREACHABLE(); 4870 UNREACHABLE();
4871 return NULL; 4871 return NULL;
4872 } 4872 }
4873 4873
4874 4874
4875 void Code::Disassemble() { 4875 void Code::Disassemble(const char* name) {
4876 PrintF("kind = %s", Kind2String(kind())); 4876 PrintF("kind = %s\n", Kind2String(kind()));
4877 if ((name != NULL) && (name[0] != '\0')) {
4878 PrintF("name = %s\n", name);
4879 }
4877 4880
4878 PrintF("\nInstructions (size = %d)\n", instruction_size()); 4881 PrintF("Instructions (size = %d)\n", instruction_size());
4879 Disassembler::Decode(NULL, this); 4882 Disassembler::Decode(NULL, this);
4880 PrintF("\n"); 4883 PrintF("\n");
4881 4884
4882 PrintF("RelocInfo (size = %d)\n", relocation_size()); 4885 PrintF("RelocInfo (size = %d)\n", relocation_size());
4883 for (RelocIterator it(this); !it.done(); it.next()) 4886 for (RelocIterator it(this); !it.done(); it.next())
4884 it.rinfo()->Print(); 4887 it.rinfo()->Print();
4885 PrintF("\n"); 4888 PrintF("\n");
4886 } 4889 }
4887 #endif // ENABLE_DISASSEMBLER 4890 #endif // ENABLE_DISASSEMBLER
4888 4891
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4949 } else { 4952 } else {
4950 Object* obj = Heap::AllocateFixedArrayWithHoles(capacity); 4953 Object* obj = Heap::AllocateFixedArrayWithHoles(capacity);
4951 if (obj->IsFailure()) return obj; 4954 if (obj->IsFailure()) return obj;
4952 new_elements = FixedArray::cast(obj); 4955 new_elements = FixedArray::cast(obj);
4953 } 4956 }
4954 set_elements(new_elements); 4957 set_elements(new_elements);
4955 return this; 4958 return this;
4956 } 4959 }
4957 4960
4958 4961
4959 void JSArray::EnsureSize(int required_size) {
4960 ASSERT(HasFastElements());
4961 if (elements()->length() >= required_size) return;
4962 Handle<FixedArray> old_backing(elements());
4963 int old_size = old_backing->length();
4964 // Doubling in size would be overkill, but leave some slack to avoid
4965 // constantly growing.
4966 int new_size = required_size + (required_size >> 3);
4967 Handle<FixedArray> new_backing = Factory::NewFixedArray(new_size);
4968 for (int i = 0; i < old_size; i++) new_backing->set(i, old_backing->get(i));
4969 SetContent(*new_backing);
4970 }
4971
4972
4973 // Computes the new capacity when expanding the elements of a JSObject. 4962 // Computes the new capacity when expanding the elements of a JSObject.
4974 static int NewElementsCapacity(int old_capacity) { 4963 static int NewElementsCapacity(int old_capacity) {
4975 // (old_capacity + 50%) + 16 4964 // (old_capacity + 50%) + 16
4976 return old_capacity + (old_capacity >> 1) + 16; 4965 return old_capacity + (old_capacity >> 1) + 16;
4977 } 4966 }
4978 4967
4979 4968
4980 static Object* ArrayLengthRangeError() { 4969 static Object* ArrayLengthRangeError() {
4981 HandleScope scope; 4970 HandleScope scope;
4982 return Top::Throw(*Factory::NewRangeError("invalid_array_length", 4971 return Top::Throw(*Factory::NewRangeError("invalid_array_length",
(...skipping 2362 matching lines...) Expand 10 before | Expand all | Expand 10 after
7345 // No break point. 7334 // No break point.
7346 if (break_point_objects()->IsUndefined()) return 0; 7335 if (break_point_objects()->IsUndefined()) return 0;
7347 // Single beak point. 7336 // Single beak point.
7348 if (!break_point_objects()->IsFixedArray()) return 1; 7337 if (!break_point_objects()->IsFixedArray()) return 1;
7349 // Multiple break points. 7338 // Multiple break points.
7350 return FixedArray::cast(break_point_objects())->length(); 7339 return FixedArray::cast(break_point_objects())->length();
7351 } 7340 }
7352 7341
7353 7342
7354 } } // namespace v8::internal 7343 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698