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

Side by Side Diff: src/runtime/runtime-classes.cc

Issue 787763005: Ensure class prototype objects have the right Map::constructor field (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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/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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 Handle<Object> args[1] = {super_class}; 92 Handle<Object> args[1] = {super_class};
93 THROW_NEW_ERROR_RETURN_FAILURE( 93 THROW_NEW_ERROR_RETURN_FAILURE(
94 isolate, 94 isolate,
95 NewTypeError("extends_value_not_a_function", HandleVector(args, 1))); 95 NewTypeError("extends_value_not_a_function", HandleVector(args, 1)));
96 } 96 }
97 } 97 }
98 98
99 Handle<Map> map = 99 Handle<Map> map =
100 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); 100 isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
101 map->set_prototype(*prototype_parent); 101 map->set_prototype(*prototype_parent);
102 map->set_constructor(*constructor);
102 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map); 103 Handle<JSObject> prototype = isolate->factory()->NewJSObjectFromMap(map);
103 104
104 Handle<String> name_string = name->IsString() 105 Handle<String> name_string = name->IsString()
105 ? Handle<String>::cast(name) 106 ? Handle<String>::cast(name)
106 : isolate->factory()->empty_string(); 107 : isolate->factory()->empty_string();
107 constructor->shared()->set_name(*name_string); 108 constructor->shared()->set_name(*name_string);
108 109
109 JSFunction::SetPrototype(constructor, prototype); 110 JSFunction::SetPrototype(constructor, prototype);
110 PropertyAttributes attribs = 111 PropertyAttributes attribs =
111 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY); 112 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE | READ_ONLY);
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 } 479 }
479 480
480 Handle<Object> result; 481 Handle<Object> result;
481 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 482 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
482 isolate, result, 483 isolate, result,
483 Execution::Call(isolate, proto_function, receiver, argc, argv, false)); 484 Execution::Call(isolate, proto_function, receiver, argc, argv, false));
484 return *result; 485 return *result;
485 } 486 }
486 } 487 }
487 } // namespace v8::internal 488 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698