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

Side by Side Diff: src/handles.cc

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 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/handles.h ('k') | src/handles-inl.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 CALL_HEAP_FUNCTION(Accessors::FunctionSetPrototype(*function, 235 CALL_HEAP_FUNCTION(Accessors::FunctionSetPrototype(*function,
236 *prototype, 236 *prototype,
237 NULL), 237 NULL),
238 Object); 238 Object);
239 } 239 }
240 240
241 241
242 Handle<Object> SetProperty(Handle<JSObject> object, 242 Handle<Object> SetProperty(Handle<JSObject> object,
243 Handle<String> key, 243 Handle<String> key,
244 Handle<Object> value, 244 Handle<Object> value,
245 PropertyAttributes attributes) { 245 PropertyAttributes attributes,
246 CALL_HEAP_FUNCTION(object->SetProperty(*key, *value, attributes), Object); 246 StrictModeFlag strict_mode) {
247 CALL_HEAP_FUNCTION(object->SetProperty(*key, *value, attributes, strict_mode),
248 Object);
247 } 249 }
248 250
249 251
250 Handle<Object> SetProperty(Handle<Object> object, 252 Handle<Object> SetProperty(Handle<Object> object,
251 Handle<Object> key, 253 Handle<Object> key,
252 Handle<Object> value, 254 Handle<Object> value,
253 PropertyAttributes attributes) { 255 PropertyAttributes attributes,
256 StrictModeFlag strict_mode) {
254 CALL_HEAP_FUNCTION( 257 CALL_HEAP_FUNCTION(
255 Runtime::SetObjectProperty(object, key, value, attributes), Object); 258 Runtime::SetObjectProperty(object, key, value, attributes, strict_mode),
259 Object);
256 } 260 }
257 261
258 262
259 Handle<Object> ForceSetProperty(Handle<JSObject> object, 263 Handle<Object> ForceSetProperty(Handle<JSObject> object,
260 Handle<Object> key, 264 Handle<Object> key,
261 Handle<Object> value, 265 Handle<Object> value,
262 PropertyAttributes attributes) { 266 PropertyAttributes attributes) {
263 CALL_HEAP_FUNCTION( 267 CALL_HEAP_FUNCTION(
264 Runtime::ForceSetObjectProperty(object, key, value, attributes), Object); 268 Runtime::ForceSetObjectProperty(
269 object, key, value, attributes),
270 Object);
265 } 271 }
266 272
267 273
268 Handle<Object> SetNormalizedProperty(Handle<JSObject> object, 274 Handle<Object> SetNormalizedProperty(Handle<JSObject> object,
269 Handle<String> key, 275 Handle<String> key,
270 Handle<Object> value, 276 Handle<Object> value,
271 PropertyDetails details) { 277 PropertyDetails details) {
272 CALL_HEAP_FUNCTION(object->SetNormalizedProperty(*key, *value, details), 278 CALL_HEAP_FUNCTION(object->SetNormalizedProperty(*key, *value, details),
273 Object); 279 Object);
274 } 280 }
(...skipping 22 matching lines...) Expand all
297 ASSERT(!Top::has_pending_exception()); 303 ASSERT(!Top::has_pending_exception());
298 CHECK(!SetLocalPropertyIgnoreAttributes( 304 CHECK(!SetLocalPropertyIgnoreAttributes(
299 object, key, value, attributes).is_null()); 305 object, key, value, attributes).is_null());
300 CHECK(!Top::has_pending_exception()); 306 CHECK(!Top::has_pending_exception());
301 } 307 }
302 308
303 309
304 Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object, 310 Handle<Object> SetPropertyWithInterceptor(Handle<JSObject> object,
305 Handle<String> key, 311 Handle<String> key,
306 Handle<Object> value, 312 Handle<Object> value,
307 PropertyAttributes attributes) { 313 PropertyAttributes attributes,
314 StrictModeFlag strict_mode) {
308 CALL_HEAP_FUNCTION(object->SetPropertyWithInterceptor(*key, 315 CALL_HEAP_FUNCTION(object->SetPropertyWithInterceptor(*key,
309 *value, 316 *value,
310 attributes), 317 attributes,
318 strict_mode),
311 Object); 319 Object);
312 } 320 }
313 321
314 322
315 Handle<Object> GetProperty(Handle<JSObject> obj, 323 Handle<Object> GetProperty(Handle<JSObject> obj,
316 const char* name) { 324 const char* name) {
317 Handle<String> str = Factory::LookupAsciiSymbol(name); 325 Handle<String> str = Factory::LookupAsciiSymbol(name);
318 CALL_HEAP_FUNCTION(obj->GetProperty(*str), Object); 326 CALL_HEAP_FUNCTION(obj->GetProperty(*str), Object);
319 } 327 }
320 328
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 Handle<String> SubString(Handle<String> str, 421 Handle<String> SubString(Handle<String> str,
414 int start, 422 int start,
415 int end, 423 int end,
416 PretenureFlag pretenure) { 424 PretenureFlag pretenure) {
417 CALL_HEAP_FUNCTION(str->SubString(start, end, pretenure), String); 425 CALL_HEAP_FUNCTION(str->SubString(start, end, pretenure), String);
418 } 426 }
419 427
420 428
421 Handle<Object> SetElement(Handle<JSObject> object, 429 Handle<Object> SetElement(Handle<JSObject> object,
422 uint32_t index, 430 uint32_t index,
423 Handle<Object> value) { 431 Handle<Object> value,
424 if (object->HasPixelElements() || object->HasExternalArrayElements()) { 432 StrictModeFlag strict_mode) {
433 if (object->HasExternalArrayElements()) {
425 if (!value->IsSmi() && !value->IsHeapNumber() && !value->IsUndefined()) { 434 if (!value->IsSmi() && !value->IsHeapNumber() && !value->IsUndefined()) {
426 bool has_exception; 435 bool has_exception;
427 Handle<Object> number = Execution::ToNumber(value, &has_exception); 436 Handle<Object> number = Execution::ToNumber(value, &has_exception);
428 if (has_exception) return Handle<Object>(); 437 if (has_exception) return Handle<Object>();
429 value = number; 438 value = number;
430 } 439 }
431 } 440 }
432 CALL_HEAP_FUNCTION(object->SetElement(index, *value), Object); 441 CALL_HEAP_FUNCTION(object->SetElement(index, *value, strict_mode), Object);
433 } 442 }
434 443
435 444
436 Handle<Object> SetOwnElement(Handle<JSObject> object, 445 Handle<Object> SetOwnElement(Handle<JSObject> object,
437 uint32_t index, 446 uint32_t index,
438 Handle<Object> value) { 447 Handle<Object> value,
439 ASSERT(!object->HasPixelElements()); 448 StrictModeFlag strict_mode) {
440 ASSERT(!object->HasExternalArrayElements()); 449 ASSERT(!object->HasExternalArrayElements());
441 CALL_HEAP_FUNCTION(object->SetElement(index, *value, false), Object); 450 CALL_HEAP_FUNCTION(object->SetElement(index, *value, strict_mode, false),
451 Object);
442 } 452 }
443 453
444 454
445 Handle<JSObject> Copy(Handle<JSObject> obj) { 455 Handle<JSObject> Copy(Handle<JSObject> obj) {
446 CALL_HEAP_FUNCTION(Heap::CopyJSObject(*obj), JSObject); 456 CALL_HEAP_FUNCTION(Heap::CopyJSObject(*obj), JSObject);
447 } 457 }
448 458
449 459
450 Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info) { 460 Handle<Object> SetAccessor(Handle<JSObject> obj, Handle<AccessorInfo> info) {
451 CALL_HEAP_FUNCTION(obj->DefineAccessor(*info), Object); 461 CALL_HEAP_FUNCTION(obj->DefineAccessor(*info), Object);
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 } 837 }
828 838
829 839
830 bool CompileLazyShared(Handle<SharedFunctionInfo> shared, 840 bool CompileLazyShared(Handle<SharedFunctionInfo> shared,
831 ClearExceptionFlag flag) { 841 ClearExceptionFlag flag) {
832 CompilationInfo info(shared); 842 CompilationInfo info(shared);
833 return CompileLazyHelper(&info, flag); 843 return CompileLazyHelper(&info, flag);
834 } 844 }
835 845
836 846
837 bool CompileLazy(Handle<JSFunction> function, 847 static bool CompileLazyFunction(Handle<JSFunction> function,
838 ClearExceptionFlag flag) { 848 ClearExceptionFlag flag,
849 InLoopFlag in_loop_flag) {
839 bool result = true; 850 bool result = true;
840 if (function->shared()->is_compiled()) { 851 if (function->shared()->is_compiled()) {
841 function->ReplaceCode(function->shared()->code()); 852 function->ReplaceCode(function->shared()->code());
842 function->shared()->set_code_age(0); 853 function->shared()->set_code_age(0);
843 } else { 854 } else {
844 CompilationInfo info(function); 855 CompilationInfo info(function);
856 if (in_loop_flag == IN_LOOP) info.MarkAsInLoop();
845 result = CompileLazyHelper(&info, flag); 857 result = CompileLazyHelper(&info, flag);
846 ASSERT(!result || function->is_compiled()); 858 ASSERT(!result || function->is_compiled());
847 } 859 }
848 if (result && function->is_compiled()) {
849 PROFILE(FunctionCreateEvent(*function));
850 }
851 return result; 860 return result;
852 } 861 }
853 862
854 863
855 bool CompileLazyInLoop(Handle<JSFunction> function, 864 bool CompileLazy(Handle<JSFunction> function,
856 ClearExceptionFlag flag) { 865 ClearExceptionFlag flag) {
857 bool result = true; 866 return CompileLazyFunction(function, flag, NOT_IN_LOOP);
858 if (function->shared()->is_compiled()) {
859 function->ReplaceCode(function->shared()->code());
860 function->shared()->set_code_age(0);
861 } else {
862 CompilationInfo info(function);
863 info.MarkAsInLoop();
864 result = CompileLazyHelper(&info, flag);
865 ASSERT(!result || function->is_compiled());
866 }
867 if (result && function->is_compiled()) {
868 PROFILE(FunctionCreateEvent(*function));
869 }
870 return result;
871 } 867 }
872 868
873 869
874 bool CompileOptimized(Handle<JSFunction> function, int osr_ast_id) { 870 bool CompileLazyInLoop(Handle<JSFunction> function,
875 CompilationInfo info(function); 871 ClearExceptionFlag flag) {
876 info.SetOptimizing(osr_ast_id); 872 return CompileLazyFunction(function, flag, IN_LOOP);
877 bool result = CompileLazyHelper(&info, KEEP_EXCEPTION);
878 if (result) PROFILE(FunctionCreateEvent(*function));
879 return result;
880 } 873 }
881 874
882 875
876 bool CompileOptimized(Handle<JSFunction> function,
877 int osr_ast_id,
878 ClearExceptionFlag flag) {
879 CompilationInfo info(function);
880 info.SetOptimizing(osr_ast_id);
881 return CompileLazyHelper(&info, flag);
882 }
883
884
883 OptimizedObjectForAddingMultipleProperties:: 885 OptimizedObjectForAddingMultipleProperties::
884 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object, 886 OptimizedObjectForAddingMultipleProperties(Handle<JSObject> object,
885 int expected_additional_properties, 887 int expected_additional_properties,
886 bool condition) { 888 bool condition) {
887 object_ = object; 889 object_ = object;
888 if (condition && object_->HasFastProperties() && !object->IsJSGlobalProxy()) { 890 if (condition && object_->HasFastProperties() && !object->IsJSGlobalProxy()) {
889 // Normalize the properties of object to avoid n^2 behavior 891 // Normalize the properties of object to avoid n^2 behavior
890 // when extending the object multiple properties. Indicate the number of 892 // when extending the object multiple properties. Indicate the number of
891 // properties to be added. 893 // properties to be added.
892 unused_property_fields_ = object->map()->unused_property_fields(); 894 unused_property_fields_ = object->map()->unused_property_fields();
(...skipping 10 matching lines...) Expand all
903 905
904 OptimizedObjectForAddingMultipleProperties:: 906 OptimizedObjectForAddingMultipleProperties::
905 ~OptimizedObjectForAddingMultipleProperties() { 907 ~OptimizedObjectForAddingMultipleProperties() {
906 // Reoptimize the object to allow fast property access. 908 // Reoptimize the object to allow fast property access.
907 if (has_been_transformed_) { 909 if (has_been_transformed_) {
908 TransformToFastProperties(object_, unused_property_fields_); 910 TransformToFastProperties(object_, unused_property_fields_);
909 } 911 }
910 } 912 }
911 913
912 } } // namespace v8::internal 914 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/handles-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698