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

Side by Side Diff: src/runtime.cc

Issue 660243: Small API improvements: (Closed)
Patch Set: Created 10 years, 10 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') | test/cctest/test-api.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-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 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 Handle<Object> result = 2839 Handle<Object> result =
2840 GetCharAt(Handle<String>(String::cast(js_value->value())), index); 2840 GetCharAt(Handle<String>(String::cast(js_value->value())), index);
2841 if (!result->IsUndefined()) return *result; 2841 if (!result->IsUndefined()) return *result;
2842 } 2842 }
2843 2843
2844 if (object->IsString() || object->IsNumber() || object->IsBoolean()) { 2844 if (object->IsString() || object->IsNumber() || object->IsBoolean()) {
2845 Handle<Object> prototype = GetPrototype(object); 2845 Handle<Object> prototype = GetPrototype(object);
2846 return prototype->GetElement(index); 2846 return prototype->GetElement(index);
2847 } 2847 }
2848 2848
2849 return GetElement(object, index);
antonm 2010/02/27 14:38:01 I am not sure it's worth refactoring, but up to yo
2850 }
2851
2852
2853 Object* Runtime::GetElement(Handle<Object> object, uint32_t index) {
2849 return object->GetElement(index); 2854 return object->GetElement(index);
2850 } 2855 }
2851 2856
2852 2857
2853 Object* Runtime::GetObjectProperty(Handle<Object> object, Handle<Object> key) { 2858 Object* Runtime::GetObjectProperty(Handle<Object> object, Handle<Object> key) {
2854 HandleScope scope; 2859 HandleScope scope;
2855 2860
2856 if (object->IsUndefined() || object->IsNull()) { 2861 if (object->IsUndefined() || object->IsNull()) {
2857 Handle<Object> args[2] = { key, object }; 2862 Handle<Object> args[2] = { key, object };
2858 Handle<Object> error = 2863 Handle<Object> error =
(...skipping 5488 matching lines...) Expand 10 before | Expand all | Expand 10 after
8347 } else { 8352 } else {
8348 // Handle last resort GC and make sure to allow future allocations 8353 // Handle last resort GC and make sure to allow future allocations
8349 // to grow the heap without causing GCs (if possible). 8354 // to grow the heap without causing GCs (if possible).
8350 Counters::gc_last_resort_from_js.Increment(); 8355 Counters::gc_last_resort_from_js.Increment();
8351 Heap::CollectAllGarbage(false); 8356 Heap::CollectAllGarbage(false);
8352 } 8357 }
8353 } 8358 }
8354 8359
8355 8360
8356 } } // namespace v8::internal 8361 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698