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

Side by Side Diff: src/accessors.cc

Issue 2122923003: [debugger] Don't leak holes from generator arguments. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: DCHECK Created 4 years, 5 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 | « no previous file | test/mjsunit/regress/regress-5164.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/accessors.h" 5 #include "src/accessors.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/contexts.h" 8 #include "src/contexts.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/execution.h" 10 #include "src/execution.h"
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 867
868 // Get the number of arguments and construct an arguments object 868 // Get the number of arguments and construct an arguments object
869 // mirror for the right frame. 869 // mirror for the right frame.
870 const int length = frame->ComputeParametersCount(); 870 const int length = frame->ComputeParametersCount();
871 Handle<JSObject> arguments = isolate->factory()->NewArgumentsObject( 871 Handle<JSObject> arguments = isolate->factory()->NewArgumentsObject(
872 function, length); 872 function, length);
873 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); 873 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length);
874 874
875 // Copy the parameters to the arguments object. 875 // Copy the parameters to the arguments object.
876 DCHECK(array->length() == length); 876 DCHECK(array->length() == length);
877 for (int i = 0; i < length; i++) array->set(i, frame->GetParameter(i)); 877 for (int i = 0; i < length; i++) {
878 Object* value = frame->GetParameter(i);
879 if (value->IsTheHole(isolate)) {
880 // Generators currently use holes as dummy arguments when resuming. We
881 // must not leak those.
882 DCHECK(IsResumableFunction(function->shared()->kind()));
883 value = isolate->heap()->undefined_value();
884 }
885 array->set(i, value);
886 }
878 arguments->set_elements(*array); 887 arguments->set_elements(*array);
879 888
880 // Return the freshly allocated arguments object. 889 // Return the freshly allocated arguments object.
881 return arguments; 890 return arguments;
882 } 891 }
883 892
884 // No frame corresponding to the given function found. Return null. 893 // No frame corresponding to the given function found. Return null.
885 return isolate->factory()->null_value(); 894 return isolate->factory()->null_value();
886 } 895 }
887 896
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 Handle<AccessorInfo> Accessors::BoundFunctionNameInfo( 1115 Handle<AccessorInfo> Accessors::BoundFunctionNameInfo(
1107 Isolate* isolate, PropertyAttributes attributes) { 1116 Isolate* isolate, PropertyAttributes attributes) {
1108 return MakeAccessor(isolate, isolate->factory()->name_string(), 1117 return MakeAccessor(isolate, isolate->factory()->name_string(),
1109 &BoundFunctionNameGetter, &ReconfigureToDataProperty, 1118 &BoundFunctionNameGetter, &ReconfigureToDataProperty,
1110 attributes); 1119 attributes);
1111 } 1120 }
1112 1121
1113 1122
1114 } // namespace internal 1123 } // namespace internal
1115 } // namespace v8 1124 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5164.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698